Skip to content

Commit

Permalink
Merge branch 'use_openpmd-api' of github.com:guj/amrex into use_openp…
Browse files Browse the repository at this point in the history
…md-api
  • Loading branch information
WeiqunZhang committed Feb 13, 2024
2 parents 996b0ca + 991055b commit 819d7cc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Src/Extern/openPMD-api/AMReX_ParticlesOPENPMD.H
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void CountParticles()
for (auto currentLevel = 0; currentLevel <= this->finestLevel(); currentLevel++)
{
// numParticles in this processor
auto numParticles = static_cast<long long>(this->NumberOfParticlesAtLevel(currentLevel, false, false));
auto numParticles = static_cast<long long>(this->NumberOfParticlesAtLevel(currentLevel, true, true));

unsigned long long offset=0; // offset of this level
unsigned long long sum=0; // numParticles in this level (sum from all processors)
Expand Down
14 changes: 14 additions & 0 deletions Src/Extern/openPMD-api/AMReX_PlotFileOPENPMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,20 @@ namespace amrex::openpmd_api {
} // CreateWriter()


void AMReX_openPMDHandler::SetWriter(amrex::openpmd_api::AMReX_openPMDWriter* w)
{
BL_ASSERT ( w != nullptr );

// assuer that input key/values are inherited
// so the openpmd filepath assigned from input file is still in use
w->m_openPMDPrefix = m_Writer->m_openPMDPrefix;
w->m_openPMDEncoding = m_Writer->m_openPMDEncoding;
w->m_openPMDFileType = m_Writer->m_openPMDFileType;
w->m_openPMDSeriesOptions = m_Writer->m_openPMDSeriesOptions;

m_Writer.reset(w);
}

////////////////////////////////////////
//
// Class AMReX_openPMDWriter
Expand Down
1 change: 1 addition & 0 deletions Src/Extern/openPMD-api/AMReX_PlotFileUtilOPENPMD.H
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ namespace amrex::openpmd_api

std::unique_ptr<AMReX_openPMDWriter> m_Writer;

void SetWriter(amrex::openpmd_api::AMReX_openPMDWriter* w);
private:
void CreateWriter(const std::string& prefix = std::string());

Expand Down
4 changes: 1 addition & 3 deletions Src/Extern/openPMD-api/AMReX_PlotFileUtilOPENPMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ namespace amrex::openpmd_api
BL_ASSERT ( m_OpenPMDHandler != nullptr );
BL_ASSERT ( w != nullptr );

// so the openpmd filepath assigned from input file is still in use
w->m_openPMDPrefix = m_OpenPMDHandler->m_Writer->m_openPMDPrefix;
m_OpenPMDHandler->m_Writer.reset(w);
m_OpenPMDHandler->SetWriter(w);
}

void CloseHandler()
Expand Down

0 comments on commit 819d7cc

Please sign in to comment.