Skip to content

Commit

Permalink
Fix includes
Browse files Browse the repository at this point in the history
We should not include std headers inside amrex namespace.
  • Loading branch information
WeiqunZhang committed Jan 22, 2025
1 parent 5969353 commit d8a3c97
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 8 deletions.
4 changes: 4 additions & 0 deletions Src/Extern/HDF5/AMReX_ParticleHDF5.H
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "H5Z_SZ.h"
#endif

namespace amrex {

template <typename ParticleType, int NArrayReal, int NArrayInt,
template<class> class Allocator, class CellAssignor>
void
Expand Down Expand Up @@ -1534,5 +1536,7 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
Gpu::streamSynchronize();
}

}

#endif /*AMREX_USE_HDF5*/
#endif /*AMREX_PARTICLEHDF5_H*/
5 changes: 5 additions & 0 deletions Src/Extern/HDF5/AMReX_ParticleUtilHDF5.H
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifdef AMREX_USE_HDF5_ASYNC
#include "hdf5.h"

namespace amrex {

hid_t es_par_g = 0;

void async_vol_es_wait_particle()
Expand Down Expand Up @@ -29,4 +31,7 @@ void async_vol_es_wait_close_particle()
}
return;
}

}

#endif
4 changes: 4 additions & 0 deletions Src/Extern/HDF5/AMReX_WriteBinaryParticleDataHDF5.H
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef AMREX_WRITE_BINARY_PARTICLE_DATA_HDF5_H
#define AMREX_WRITE_BINARY_PARTICLE_DATA_HDF5_H

namespace amrex {

static int CreateWriteHDF5Attr(hid_t loc, const char *name, hsize_t n, void *data, hid_t dtype)
{
herr_t ret;
Expand Down Expand Up @@ -476,4 +478,6 @@ void WriteHDF5ParticleDataSync (PC const& pc,
return;
} // End WriteHDF5ParticleDataSync

}

#endif /*AMREX_WRITE_BINARY_PARTICLE_DATA_HDF5_H*/
4 changes: 4 additions & 0 deletions Src/Particle/AMReX_MakeParticle.H
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include <type_traits>

namespace amrex {

template< class T >
struct is_soa_particle
: std::integral_constant<
Expand Down Expand Up @@ -37,4 +39,6 @@ struct make_particle<T_ParticleType, std::enable_if_t<is_soa_particle<T_Particle
}
};

}

#endif
4 changes: 2 additions & 2 deletions Src/Particle/AMReX_NeighborParticles.H
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,8 @@ protected:
bool m_has_neighbors = false;
};

}

#include "AMReX_NeighborParticlesI.H"

#ifdef AMREX_USE_GPU
Expand All @@ -491,6 +493,4 @@ protected:
#include "AMReX_NeighborParticlesCPUImpl.H"
#endif

}

#endif // _NEIGHBORPARTICLES_H_
4 changes: 4 additions & 0 deletions Src/Particle/AMReX_NeighborParticlesCPUImpl.H
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define AMREX_NEIGHBORPARTICLESCPUIMPL_H_
#include <AMReX_Config.H>

namespace amrex {

template <int NStructReal, int NStructInt, int NArrayReal, int NArrayInt>
void
NeighborParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt>
Expand Down Expand Up @@ -653,4 +655,6 @@ fillNeighborsMPI (bool reuse_rcv_counts) {
#endif
}

}

#endif
4 changes: 4 additions & 0 deletions Src/Particle/AMReX_NeighborParticlesGPUImpl.H
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define AMREX_NEIGHBORPARTICLESGPUIMPL_H_
#include <AMReX_Config.H>

namespace amrex {

namespace detail
{
inline Vector<Box> getBoundaryBoxes(const Box& box, int ncells)
Expand Down Expand Up @@ -314,4 +316,6 @@ clearNeighborsGPU()
}
}

}

#endif
4 changes: 4 additions & 0 deletions Src/Particle/AMReX_NeighborParticlesI.H
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

namespace amrex {

template <int NStructReal, int NStructInt, int NArrayReal, int NArrayInt>
bool NeighborParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt>::use_mask = false;

Expand Down Expand Up @@ -1127,3 +1129,5 @@ resizeContainers (int num_levels)
AMREX_ASSERT((neighbors.size() == m_neighbor_list.size()) &&
(neighbors.size() == mask_ptr.size() ) );
}

}
4 changes: 3 additions & 1 deletion Src/Particle/AMReX_ParticleBufferMap.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <AMReX_ParticleBufferMap.H>

using namespace amrex;
namespace amrex {

ParticleBufferMap::ParticleBufferMap (const ParGDBBase* a_gdb)
{
Expand Down Expand Up @@ -130,3 +130,5 @@ bool ParticleBufferMap::isValid (const ParGDBBase* a_gdb) const

return valid;
}

}
4 changes: 3 additions & 1 deletion Src/Particle/AMReX_ParticleCommunication.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <AMReX_ParticleCommunication.H>
#include <AMReX_ParallelDescriptor.H>

using namespace amrex;
namespace amrex {

void ParticleCopyOp::clear ()
{
Expand Down Expand Up @@ -397,3 +397,5 @@ void amrex::communicateParticlesFinish (const ParticleCopyPlan& plan)
amrex::ignore_unused(plan);
#endif
}

}
3 changes: 1 addition & 2 deletions Src/Particle/AMReX_ParticleContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,7 @@ using ParticleContainer = ParticleContainer_impl<Particle<T_NStructReal, T_NStru
template <int T_NArrayReal, int T_NArrayInt, template<class> class Allocator=DefaultAllocator, class CellAssignor=DefaultAssignor>
using ParticleContainerPureSoA = ParticleContainer_impl<SoAParticle<T_NArrayReal, T_NArrayInt>, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor>;

}

#include "AMReX_ParticleInit.H"
#include "AMReX_ParticleContainerI.H"
Expand All @@ -1538,6 +1539,4 @@ using ParticleContainerPureSoA = ParticleContainer_impl<SoAParticle<T_NArrayReal
#include "AMReX_ParticleHDF5.H"
#endif

}

#endif /*_PARTICLES_H_*/
4 changes: 3 additions & 1 deletion Src/Particle/AMReX_ParticleContainerBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <AMReX_ParallelDescriptor.H>
#include <AMReX_iMultiFab.H>

using namespace amrex;
namespace amrex {

bool ParticleContainerBase::do_tiling = false;
IntVect ParticleContainerBase::tile_size { AMREX_D_DECL(1024000,8,8) };
Expand Down Expand Up @@ -329,3 +329,5 @@ void ParticleContainerBase::BuildRedistributeMask (int lev, int nghost) const
RemoveDuplicates(neighbor_procs);
}
}

}
3 changes: 3 additions & 0 deletions Src/Particle/AMReX_ParticleContainerI.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <type_traits>
#include <vector>

namespace amrex {

template <typename ParticleType, int NArrayReal, int NArrayInt,
template<class> class Allocator, class CellAssignor>
Expand Down Expand Up @@ -2668,3 +2669,5 @@ ResizeRuntimeIntComp (int new_size, bool communicate)
}
}
}

}
4 changes: 4 additions & 0 deletions Src/Particle/AMReX_ParticleIO.H
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include <AMReX_WriteBinaryParticleData.H>

namespace amrex {

template <typename ParticleType, int NArrayReal, int NArrayInt,
template<class> class Allocator, class CellAssignor>
void
Expand Down Expand Up @@ -1274,4 +1276,6 @@ ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator, CellAssig
}
}

}

#endif /*AMREX_PARTICLEIO_H*/
5 changes: 5 additions & 0 deletions Src/Particle/AMReX_ParticleInit.H
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define AMREX_PARTICLEINIT_H
#include <AMReX_Config.H>

namespace amrex {

/*
\brief Initialize particles from an Ascii file in the following format:

Expand Down Expand Up @@ -1683,4 +1685,7 @@ InitNRandomPerCell (int n_per_cell, const ParticleInitData& pdata)

Gpu::streamSynchronize();
}

}

#endif /*AMREX_PARTICLEINIT_H*/
2 changes: 1 addition & 1 deletion Src/Particle/AMReX_ParticleUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ Vector<int> computeNeighborProcs (const ParGDBBase* a_gdb, int ngrow)
RemoveDuplicates(neighbor_procs);
return neighbor_procs;
}
}

#ifdef AMREX_USE_HDF5_ASYNC
#include "AMReX_ParticleUtilHDF5.H"
#endif
}
4 changes: 4 additions & 0 deletions Src/Particle/AMReX_WriteBinaryParticleData.H
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <AMReX_ParticleUtil.H>
#include <AMReX_GpuDevice.H>

namespace amrex {

struct KeepValidFilter
{
template <typename SrcData>
Expand Down Expand Up @@ -1158,6 +1160,8 @@ void WriteBinaryParticleDataAsync (PC const& pc,
});
}

}

#ifdef AMREX_USE_HDF5
#include <AMReX_WriteBinaryParticleDataHDF5.H>
#endif
Expand Down

0 comments on commit d8a3c97

Please sign in to comment.