diff --git a/examples/hello/bpWriter/helloBPWriter_nompi.cpp b/examples/hello/bpWriter/helloBPWriter_nompi.cpp index 89eb754a1ae7f5f24ccc4b8041fabdcd5edee55d..18e965be8154eb2b477809a4330f97c34a8960ae 100644 --- a/examples/hello/bpWriter/helloBPWriter_nompi.cpp +++ b/examples/hello/bpWriter/helloBPWriter_nompi.cpp @@ -34,9 +34,9 @@ int main( int argc, char* argv [] ) { //Define variable and local size adios::Variable<double>& ioMyDoubles = adios.DefineVariable<double>( "myDoubles", adios::Dims{Nx} ); - adios::Variable<float>& ioMyMatrix = adios.DefineVariable<float>( "myMatrix", adios::Dims{rows,columns} ); - adios::Variable<float>& ioMyMatrix2 = adios.DefineVariable<float>( "myMatrix2", adios::Dims{rows,columns} ); - adios::Variable<float>& ioMyMatrix3 = adios.DefineVariable<float>( "myMatrix3", adios::Dims{rows,columns} ); +// adios::Variable<float>& ioMyMatrix = adios.DefineVariable<float>( "myMatrix", adios::Dims{rows,columns} ); +// adios::Variable<float>& ioMyMatrix2 = adios.DefineVariable<float>( "myMatrix2", adios::Dims{rows,columns} ); +// adios::Variable<float>& ioMyMatrix3 = adios.DefineVariable<float>( "myMatrix3", adios::Dims{rows,columns} ); //Define method for engine creation, it is basically straight-forward parameters adios::Method& bpWriterSettings = adios.DeclareMethod( "SinglePOSIXFile" ); //default method type is Writer @@ -51,9 +51,9 @@ int main( int argc, char* argv [] ) throw std::ios_base::failure( "ERROR: couldn't create bpWriter at Open\n" ); bpFileWriter->Write<double>( ioMyDoubles, myDoubles.data() ); // Base class Engine own the Write<T> that will call overloaded Write from Derived - bpFileWriter->Write<float>( ioMyMatrix, myMatrix.data() ); //2d Example - bpFileWriter->Write<float>( ioMyMatrix2, myMatrix2.data() ); //2d Example - bpFileWriter->Write<float>( ioMyMatrix3, myMatrix2.data() ); //2d Example +// bpFileWriter->Write<float>( ioMyMatrix, myMatrix.data() ); //2d Example +// bpFileWriter->Write<float>( ioMyMatrix2, myMatrix2.data() ); //2d Example +// bpFileWriter->Write<float>( ioMyMatrix3, myMatrix2.data() ); //2d Example bpFileWriter->Close( ); // } diff --git a/include/format/BP1Writer.h b/include/format/BP1Writer.h index 4e7de34247a5b150393789fd2aa725d95dc7a532..94a3bed8e8bbc0705f34300bea3c18583e4ce05b 100644 --- a/include/format/BP1Writer.h +++ b/include/format/BP1Writer.h @@ -253,7 +253,7 @@ private: } else //update characteristics sets count { - const std::size_t characteristicsSetsCountPosition = 15 + variable.m_Name.size(); + const std::size_t characteristicsSetsCountPosition = 13 + variable.m_Name.size(); ++index.Count; CopyToBuffer( buffer, characteristicsSetsCountPosition, &index.Count ); //test } diff --git a/src/format/BP1Writer.cpp b/src/format/BP1Writer.cpp index f2bf8bd669befbe4d09de2b802553df60f9346f9..662f37ac2a6eb6b3a8c22c26a15f600ab2920ff4 100644 --- a/src/format/BP1Writer.cpp +++ b/src/format/BP1Writer.cpp @@ -55,7 +55,8 @@ void BP1Writer::WriteProcessGroupIndex( const bool isFortran, const std::string //processID in metadata, CopyToBuffer( metadataBuffer, &processID ); - metadataBuffer.insert( metadataBuffer.end(), 4, 0 ); //skip coordination var in data ....what is coordination var? + //skip coordination var in data ....what is coordination var? + dataBuffer.insert( dataBuffer.end(), 4, 0 ); //time step name to metadata and data const std::string timeStepName( std::to_string( metadataSet.TimeStep ) ); @@ -320,9 +321,8 @@ void BP1Writer::FlattenMetadata( BP1MetadataSet& metadataSet, capsule::STLVector //Finish writing metadata counts and lengths //PG Index - CopyToBuffer( metadataSet.PGIndex.Buffer, 0, &metadataSet.DataPGCount ); - const std::uint64_t pgLength = metadataSet.PGIndex.Buffer.size() - 16; - CopyToBuffer( metadataSet.PGIndex.Buffer, 8, &pgLength ); + const std::uint64_t pgCount = metadataSet.DataPGCount; + const std::uint64_t pgLength = metadataSet.PGIndex.Buffer.size(); //var index count and length (total), and each index length std::uint32_t varsCount; @@ -334,13 +334,17 @@ void BP1Writer::FlattenMetadata( BP1MetadataSet& metadataSet, capsule::STLVector lf_IndexCountLength( metadataSet.AttributesIndices, attributesCount, attributesLength ); const std::size_t footerSize = (pgLength+16) + (varsLength+12) + (attributesLength+12) + metadataSet.MiniFooterSize; - auto& buffer = heap.m_Data; buffer.reserve( buffer.size() + footerSize ); //reserve data to fit metadata, must replace with growth buffer strategy - CopyToBuffer( buffer, metadataSet.PGIndex.Buffer.data(), metadataSet.PGIndex.Buffer.size() ); //PGIndex - lf_FlattenIndices( varsCount, varsLength, metadataSet.VarsIndices, buffer ); //VarsIndices - lf_FlattenIndices( attributesCount, attributesLength, metadataSet.AttributesIndices, buffer ); //AttributesIndices + //write pg index + CopyToBuffer( buffer, &pgCount ); + CopyToBuffer( buffer, &pgLength ); + CopyToBuffer( buffer, metadataSet.PGIndex.Buffer.data(), pgLength ); + //Vars indices + lf_FlattenIndices( varsCount, varsLength, metadataSet.VarsIndices, buffer ); + //Attribute indices + lf_FlattenIndices( attributesCount, attributesLength, metadataSet.AttributesIndices, buffer ); //getting absolute offsets, minifooter is 28 bytes for now const std::uint64_t offsetPGIndex = heap.m_DataAbsolutePosition;