diff --git a/CMakeLists.txt b/CMakeLists.txt index a2428c6..a517e9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ include(GNUInstallDirs) # find dependencies (MPI and Kokkos found through Cabana) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) find_package(CLANG_FORMAT 10) -find_package(Cabana REQUIRED 0.5 COMPONENTS Cabana::Cajita Cabana::cabanacore) +find_package(Cabana REQUIRED 0.5 COMPONENTS Cabana::Grid Cabana::Core) find_package(ArborX REQUIRED) find_package(Boost 1.66.0 REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e3f7ce8..e981735 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,8 +36,8 @@ set(SOURCES add_library(picasso ${SOURCES}) target_link_libraries(picasso - Cabana::cabanacore - Cabana::Cajita + Cabana::Core + Cabana::Grid ArborX::ArborX Boost::boost ) diff --git a/src/Picasso_APIC.hpp b/src/Picasso_APIC.hpp index daa5158..4e89867 100644 --- a/src/Picasso_APIC.hpp +++ b/src/Picasso_APIC.hpp @@ -12,11 +12,10 @@ #ifndef PICASSO_APIC_HPP #define PICASSO_APIC_HPP -#include - #include #include +#include #include #include @@ -55,20 +54,21 @@ typename SplineDataType::scalar_type KOKKOS_INLINE_FUNCTION inertialScaling( // (1*N matrix) and particle affine matrix B_p ( 3*N matrix ). template -KOKKOS_INLINE_FUNCTION void -p2g( const ParticleMass& m_p, const ParticleField& c_p, const GridMass& m_i, - const GridField& mu_i, const SplineDataType& sd, - typename std::enable_if< - ( ( Cajita::isNode::value || - Cajita::isCell::value ) && - ( SplineDataType::order == 2 || SplineDataType::order == 3 ) ), - void*>::type = 0 ) +KOKKOS_INLINE_FUNCTION void p2g( + const ParticleMass& m_p, const ParticleField& c_p, const GridMass& m_i, + const GridField& mu_i, const SplineDataType& sd, + typename std::enable_if< + ( ( Cabana::Grid::isNode::value || + Cabana::Grid::isCell< + typename SplineDataType::entity_type>::value ) && + ( SplineDataType::order == 2 || SplineDataType::order == 3 ) ), + void*>::type = 0 ) { - static_assert( Cajita::P2G::is_scatter_view::value, + static_assert( Cabana::Grid::P2G::is_scatter_view::value, "P2G requires a Kokkos::ScatterView" ); auto field_access = mu_i.access(); - static_assert( Cajita::P2G::is_scatter_view::value, + static_assert( Cabana::Grid::P2G::is_scatter_view::value, "P2G requires a Kokkos::ScatterView" ); auto mass_access = m_i.access(); @@ -147,20 +147,21 @@ p2g( const ParticleMass& m_p, const ParticleField& c_p, const GridMass& m_i, // u_p (1*3 matrix) and particle affine matrix B_p ( 3*3 matrix ). template -KOKKOS_INLINE_FUNCTION void -p2g( const ParticleMass& m_p, const ParticleVelocity& c_p, const GridMass& m_i, - const GridMomentum& mu_i, const SplineDataType& sd, - typename std::enable_if< - ( ( Cajita::isEdge::value || - Cajita::isFace::value ) && - ( SplineDataType::order == 2 || SplineDataType::order == 3 ) ), - void*>::type = 0 ) +KOKKOS_INLINE_FUNCTION void p2g( + const ParticleMass& m_p, const ParticleVelocity& c_p, const GridMass& m_i, + const GridMomentum& mu_i, const SplineDataType& sd, + typename std::enable_if< + ( ( Cabana::Grid::isEdge::value || + Cabana::Grid::isFace< + typename SplineDataType::entity_type>::value ) && + ( SplineDataType::order == 2 || SplineDataType::order == 3 ) ), + void*>::type = 0 ) { - static_assert( Cajita::P2G::is_scatter_view::value, + static_assert( Cabana::Grid::P2G::is_scatter_view::value, "P2G requires a Kokkos::ScatterView" ); auto momentum_access = mu_i.access(); - static_assert( Cajita::P2G::is_scatter_view::value, + static_assert( Cabana::Grid::P2G::is_scatter_view::value, "P2G requires a Kokkos::ScatterView" ); auto mass_access = m_i.access(); @@ -238,20 +239,21 @@ p2g( const ParticleMass& m_p, const ParticleVelocity& c_p, const GridMass& m_i, // 3*N matrix ). template -KOKKOS_INLINE_FUNCTION void -p2g( const ParticleMass& m_p, const ParticleField& c_p, const GridMass& m_i, - const GridField& mu_i, const SplineDataType& sd, - typename std::enable_if< - ( ( Cajita::isNode::value || - Cajita::isCell::value ) && - ( SplineDataType::order == 1 ) ), - void*>::type = 0 ) +KOKKOS_INLINE_FUNCTION void p2g( + const ParticleMass& m_p, const ParticleField& c_p, const GridMass& m_i, + const GridField& mu_i, const SplineDataType& sd, + typename std::enable_if< + ( ( Cabana::Grid::isNode::value || + Cabana::Grid::isCell< + typename SplineDataType::entity_type>::value ) && + ( SplineDataType::order == 1 ) ), + void*>::type = 0 ) { - static_assert( Cajita::P2G::is_scatter_view::value, + static_assert( Cabana::Grid::P2G::is_scatter_view::value, "P2G requires a Kokkos::ScatterView" ); auto field_access = mu_i.access(); - static_assert( Cajita::P2G::is_scatter_view::value, + static_assert( Cabana::Grid::P2G::is_scatter_view::value, "P2G requires a Kokkos::ScatterView" ); auto mass_access = m_i.access(); @@ -324,20 +326,21 @@ p2g( const ParticleMass& m_p, const ParticleField& c_p, const GridMass& m_i, // ). template -KOKKOS_INLINE_FUNCTION void -p2g( const ParticleMass& m_p, const ParticleVelocity& c_p, const GridMass& m_i, - const GridMomentum& mu_i, const SplineDataType& sd, - typename std::enable_if< - ( ( Cajita::isEdge::value || - Cajita::isFace::value ) && - ( SplineDataType::order == 1 ) ), - void*>::type = 0 ) +KOKKOS_INLINE_FUNCTION void p2g( + const ParticleMass& m_p, const ParticleVelocity& c_p, const GridMass& m_i, + const GridMomentum& mu_i, const SplineDataType& sd, + typename std::enable_if< + ( ( Cabana::Grid::isEdge::value || + Cabana::Grid::isFace< + typename SplineDataType::entity_type>::value ) && + ( SplineDataType::order == 1 ) ), + void*>::type = 0 ) { - static_assert( Cajita::P2G::is_scatter_view::value, + static_assert( Cabana::Grid::P2G::is_scatter_view::value, "P2G requires a Kokkos::ScatterView" ); auto momentum_access = mu_i.access(); - static_assert( Cajita::P2G::is_scatter_view::value, + static_assert( Cabana::Grid::P2G::is_scatter_view::value, "P2G requires a Kokkos::ScatterView" ); auto mass_access = m_i.access(); @@ -405,8 +408,8 @@ template KOKKOS_INLINE_FUNCTION void g2p( const GridField& u_i, ParticleField& c_p, const SplineDataType& sd, typename std::enable_if< - ( Cajita::isNode::value || - Cajita::isCell::value ), + ( Cabana::Grid::isNode::value || + Cabana::Grid::isCell::value ), void*>::type = 0 ) { using value_type = typename GridField::value_type; @@ -475,8 +478,8 @@ template KOKKOS_INLINE_FUNCTION void g2p( const GridMomentum& u_i, ParticleVelocity& c_p, const SplineDataType& sd, typename std::enable_if< - ( Cajita::isEdge::value || - Cajita::isFace::value ), + ( Cabana::Grid::isEdge::value || + Cabana::Grid::isFace::value ), void*>::type = 0 ) { static_assert( SplineDataType::has_weight_values, diff --git a/src/Picasso_AdaptiveMesh.hpp b/src/Picasso_AdaptiveMesh.hpp index c8512c6..5239331 100644 --- a/src/Picasso_AdaptiveMesh.hpp +++ b/src/Picasso_AdaptiveMesh.hpp @@ -12,8 +12,8 @@ #ifndef PICASSO_ADAPTIVEMESH_HPP #define PICASSO_ADAPTIVEMESH_HPP -#include - +#include +#include #include #include @@ -33,14 +33,15 @@ template class AdaptiveMesh { public: - using cajita_mesh = Cajita::UniformMesh; + using cabana_mesh = Cabana::Grid::UniformMesh; using memory_space = MemorySpace; - using local_grid = Cajita::LocalGrid; + using local_grid = Cabana::Grid::LocalGrid; - using node_array = Cajita::Array, MemorySpace>; + using node_array = + Cabana::Grid::Array, MemorySpace>; static constexpr std::size_t num_space_dim = 3; @@ -152,16 +153,17 @@ class AdaptiveMesh } // Create the global mesh. - auto global_mesh = Cajita::createUniformGlobalMesh( + auto global_mesh = Cabana::Grid::createUniformGlobalMesh( global_low_corner, global_high_corner, global_num_cell ); // Create the partitioner. const auto& part_params = mesh_params.get_child( "partitioner" ); - std::shared_ptr> partitioner; + std::shared_ptr> partitioner; if ( part_params.get( "type" ).compare( "uniform_dim" ) == 0 ) { - partitioner = std::make_shared>(); + partitioner = + std::make_shared>(); } else if ( part_params.get( "type" ).compare( "manual" ) == 0 ) @@ -177,13 +179,14 @@ class AdaptiveMesh ranks_per_dim[d] = element.second.get_value(); ++d; } - partitioner = std::make_shared>( - ranks_per_dim ); + partitioner = + std::make_shared>( + ranks_per_dim ); } // Build the global grid. - auto global_grid = Cajita::createGlobalGrid( comm, global_mesh, - periodic, *partitioner ); + auto global_grid = Cabana::Grid::createGlobalGrid( + comm, global_mesh, periodic, *partitioner ); // Get the halo cell width. If the user does not assign one then it is // assumed the minimum halo cell width will be used. @@ -191,7 +194,8 @@ class AdaptiveMesh _minimum_halo_width, mesh_params.get( "halo_cell_width", 0 ) ); // Build the local grid. - _local_grid = Cajita::createLocalGrid( global_grid, halo_cell_width ); + _local_grid = + Cabana::Grid::createLocalGrid( global_grid, halo_cell_width ); // Create the nodes. buildNodes( cell_size, exec_space ); @@ -216,27 +220,28 @@ class AdaptiveMesh { // Create both owned and ghosted nodes so we don't have to gather // initially. - auto node_layout = - Cajita::createArrayLayout( _local_grid, 3, Cajita::Node() ); - _nodes = Cajita::createArray( "mesh_nodes", - node_layout ); + auto node_layout = Cabana::Grid::createArrayLayout( + _local_grid, 3, Cabana::Grid::Node() ); + _nodes = Cabana::Grid::createArray( "mesh_nodes", + node_layout ); auto node_view = _nodes->view(); auto local_mesh = - Cajita::createLocalMesh( *_local_grid ); - auto local_space = _local_grid->indexSpace( - Cajita::Ghost(), Cajita::Node(), Cajita::Local() ); + Cabana::Grid::createLocalMesh( *_local_grid ); + auto local_space = _local_grid->indexSpace( Cabana::Grid::Ghost(), + Cabana::Grid::Node(), + Cabana::Grid::Local() ); Kokkos::parallel_for( "Picasso::AdaptiveMesh::CreateNodes", - Cajita::createExecutionPolicy( local_space, exec_space ), + Cabana::Grid::createExecutionPolicy( local_space, exec_space ), KOKKOS_LAMBDA( const int i, const int j, const int k ) { node_view( i, j, k, 0 ) = - local_mesh.lowCorner( Cajita::Ghost(), 0 ) + + local_mesh.lowCorner( Cabana::Grid::Ghost(), 0 ) + i * cell_size[0]; node_view( i, j, k, 1 ) = - local_mesh.lowCorner( Cajita::Ghost(), 1 ) + + local_mesh.lowCorner( Cabana::Grid::Ghost(), 1 ) + j * cell_size[1]; node_view( i, j, k, 2 ) = - local_mesh.lowCorner( Cajita::Ghost(), 2 ) + + local_mesh.lowCorner( Cabana::Grid::Ghost(), 2 ) + k * cell_size[2]; } ); } diff --git a/src/Picasso_BilinearMeshMapping.hpp b/src/Picasso_BilinearMeshMapping.hpp index e6559fa..e6bbef0 100644 --- a/src/Picasso_BilinearMeshMapping.hpp +++ b/src/Picasso_BilinearMeshMapping.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include @@ -460,10 +460,11 @@ struct BilinearMeshGenerator> // Create local nodes. auto local_grid = coords.layout()->localGrid(); - auto local_space = local_grid->indexSpace( - Cajita::Ghost(), Cajita::Node(), Cajita::Local() ); + auto local_space = + local_grid->indexSpace( Cabana::Grid::Ghost(), Cabana::Grid::Node(), + Cabana::Grid::Local() ); auto local_mesh = - Cajita::createLocalMesh( *local_grid ); + Cabana::Grid::createLocalMesh( *local_grid ); for ( int i = local_space.min( Dim::I ); i < local_space.max( Dim::I ); ++i ) for ( int j = local_space.min( Dim::J ); @@ -473,17 +474,20 @@ struct BilinearMeshGenerator> { coords_h( i, j, k, Dim::I ) = generator.global_bounding_box[Dim::I] + - ( local_mesh.lowCorner( Cajita::Ghost(), Dim::I ) + + ( local_mesh.lowCorner( Cabana::Grid::Ghost(), + Dim::I ) + i ) * generator.cell_size; coords_h( i, j, k, Dim::J ) = generator.global_bounding_box[Dim::J] + - ( local_mesh.lowCorner( Cajita::Ghost(), Dim::J ) + + ( local_mesh.lowCorner( Cabana::Grid::Ghost(), + Dim::J ) + j ) * generator.cell_size; coords_h( i, j, k, Dim::K ) = generator.global_bounding_box[Dim::K] + - ( local_mesh.lowCorner( Cajita::Ghost(), Dim::K ) + + ( local_mesh.lowCorner( Cabana::Grid::Ghost(), + Dim::K ) + k ) * generator.cell_size; } @@ -505,10 +509,11 @@ struct BilinearMeshGenerator> // Create owned nodes. auto local_grid = coords.layout()->localGrid(); - auto local_space = local_grid->indexSpace( - Cajita::Ghost(), Cajita::Node(), Cajita::Local() ); + auto local_space = + local_grid->indexSpace( Cabana::Grid::Ghost(), Cabana::Grid::Node(), + Cabana::Grid::Local() ); auto local_mesh = - Cajita::createLocalMesh( *local_grid ); + Cabana::Grid::createLocalMesh( *local_grid ); for ( int i = local_space.min( Dim::I ); i < local_space.max( Dim::I ); ++i ) for ( int j = local_space.min( Dim::J ); @@ -516,11 +521,13 @@ struct BilinearMeshGenerator> { coords_h( i, j, Dim::I ) = generator.global_bounding_box[Dim::I] + - ( local_mesh.lowCorner( Cajita::Ghost(), Dim::I ) + i ) * + ( local_mesh.lowCorner( Cabana::Grid::Ghost(), Dim::I ) + + i ) * generator.cell_size; coords_h( i, j, Dim::J ) = generator.global_bounding_box[Dim::J] + - ( local_mesh.lowCorner( Cajita::Ghost(), Dim::J ) + j ) * + ( local_mesh.lowCorner( Cabana::Grid::Ghost(), Dim::J ) + + j ) * generator.cell_size; } diff --git a/src/Picasso_CurvilinearMesh.hpp b/src/Picasso_CurvilinearMesh.hpp index c19fc75..ed335d4 100644 --- a/src/Picasso_CurvilinearMesh.hpp +++ b/src/Picasso_CurvilinearMesh.hpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include @@ -181,9 +181,10 @@ class CurvilinearMesh static constexpr std::size_t num_space_dim = CurvilinearMeshMapping::num_space_dim; - using cajita_mesh = Cajita::UniformMesh; + using cabana_mesh = Cabana::Grid::UniformMesh; + using cajita_mesh [[deprecated]] = cabana_mesh; - using local_grid = Cajita::LocalGrid; + using local_grid = Cabana::Grid::LocalGrid; /*! \brief Constructor. @@ -215,16 +216,17 @@ class CurvilinearMesh } // Create the global mesh. - auto global_mesh = Cajita::createUniformGlobalMesh( + auto global_mesh = Cabana::Grid::createUniformGlobalMesh( global_low_corner, global_high_corner, global_num_cell ); // Build the global grid. - auto global_grid = Cajita::createGlobalGrid( + auto global_grid = Cabana::Grid::createGlobalGrid( comm, global_mesh, periodic, - Cajita::ManualBlockPartitioner( ranks_per_dim ) ); + Cabana::Grid::ManualBlockPartitioner( + ranks_per_dim ) ); // Build the local grid. - _local_grid = Cajita::createLocalGrid( global_grid, halo_width ); + _local_grid = Cabana::Grid::createLocalGrid( global_grid, halo_width ); } // Get the mesh mapping. diff --git a/src/Picasso_FieldManager.hpp b/src/Picasso_FieldManager.hpp index 07b7284..d898d16 100644 --- a/src/Picasso_FieldManager.hpp +++ b/src/Picasso_FieldManager.hpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include @@ -34,11 +34,11 @@ namespace Picasso template auto createArray( const Mesh& mesh, Location, FieldTag ) { - auto array_layout = Cajita::createArrayLayout( + auto array_layout = Cabana::Grid::createArrayLayout( mesh.localGrid(), FieldTag::size, typename Location::entity_type() ); - return Cajita::createArray( FieldTag::label(), - array_layout ); + return Cabana::Grid::createArray( + FieldTag::label(), array_layout ); } //---------------------------------------------------------------------------// @@ -53,12 +53,12 @@ struct FieldHandleBase template struct FieldHandle : public FieldHandleBase { - std::shared_ptr> + typename Mesh::cabana_mesh, typename Mesh::memory_space>> array; - std::shared_ptr> halo; + std::shared_ptr> halo; }; //---------------------------------------------------------------------------// @@ -97,9 +97,9 @@ class FieldManager FieldLocation::Node, Field::PhysicalPosition, Mesh>>(); handle->array = _mesh->nodes(); - handle->halo = - Cajita::createHalo( Cajita::NodeHaloPattern(), - -1, *( handle->array ) ); + handle->halo = Cabana::Grid::createHalo( + Cabana::Grid::NodeHaloPattern(), -1, + *( handle->array ) ); _fields.emplace( key, handle ); } @@ -160,7 +160,7 @@ class FieldManager auto handle = getFieldHandle( location, tag ); handle->halo->scatter( typename mesh_type::memory_space::execution_space(), - Cajita::ScatterReduce::Sum(), *( handle->array ) ); + Cabana::Grid::ScatterReduce::Sum(), *( handle->array ) ); } // Scatter a field by layout. @@ -202,9 +202,9 @@ class FieldManager { auto handle = std::make_shared>(); handle->array = createArray( *_mesh, location, tag ); - handle->halo = - Cajita::createHalo( Cajita::NodeHaloPattern(), - -1, *( handle->array ) ); + handle->halo = Cabana::Grid::createHalo( + Cabana::Grid::NodeHaloPattern(), -1, + *( handle->array ) ); return handle; } diff --git a/src/Picasso_FieldTypes.hpp b/src/Picasso_FieldTypes.hpp index a8f4a0d..11bc6c0 100644 --- a/src/Picasso_FieldTypes.hpp +++ b/src/Picasso_FieldTypes.hpp @@ -14,7 +14,7 @@ #include -#include +#include #include @@ -73,7 +73,7 @@ template struct FieldViewTuple { static_assert( Cabana::is_parameter_pack::value, - "Views must be in a Cajita::ParameterPack" ); + "Views must be in a Cabana::Grid::ParameterPack" ); Views _views; @@ -126,14 +126,14 @@ namespace FieldLocation { struct Cell { - using entity_type = Cajita::Cell; + using entity_type = Cabana::Grid::Cell; static std::string label() { return "Cell"; } }; template struct Face { - using entity_type = Cajita::Face; + using entity_type = Cabana::Grid::Face; static std::string label() { std::stringstream l; @@ -145,7 +145,7 @@ struct Face template struct Edge { - using entity_type = Cajita::Edge; + using entity_type = Cabana::Grid::Edge; static std::string label() { std::stringstream l; @@ -156,7 +156,7 @@ struct Edge struct Node { - using entity_type = Cajita::Node; + using entity_type = Cabana::Grid::Node; static std::string label() { return "Node"; } }; diff --git a/src/Picasso_GridOperator.hpp b/src/Picasso_GridOperator.hpp index dbab4f4..c423801 100644 --- a/src/Picasso_GridOperator.hpp +++ b/src/Picasso_GridOperator.hpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include @@ -117,7 +117,7 @@ struct GridOperatorDependencies<> // Create a halo for the gather fields. template - static std::shared_ptr> + static std::shared_ptr> createGatherHalo( const FieldManager_t&, MemorySpace ) { return nullptr; @@ -125,7 +125,7 @@ struct GridOperatorDependencies<> // Create a halo for the scatter fields. template - static std::shared_ptr> + static std::shared_ptr> createScatterHalo( const FieldManager_t&, MemorySpace ) { return nullptr; @@ -181,17 +181,18 @@ struct GridOperatorDependencies, Dependencies...> // Create a halo for the gather fields. template - static std::shared_ptr> + static std::shared_ptr> createGatherHalo( const FieldManager_t& fm, MemorySpace ) { - return Cajita::createHalo( - Cajita::NodeHaloPattern(), + return Cabana::Grid::createHalo( + Cabana::Grid::NodeHaloPattern< + FieldManager_t::mesh_type::num_space_dim>(), -1, ( *fm.array( Layouts{} ) )... ); } // Create a halo for the scatter fields. template - static std::shared_ptr> + static std::shared_ptr> createScatterHalo( const FieldManager_t& fm, MemorySpace space ) { return GridOperatorDependencies::createScatterHalo( @@ -250,7 +251,7 @@ struct GridOperatorDependencies, // Create a halo for the gather fields. template - static std::shared_ptr> + static std::shared_ptr> createGatherHalo( const FieldManager_t&, MemorySpace ) { return nullptr; @@ -258,11 +259,12 @@ struct GridOperatorDependencies, // Create a halo for the scatter fields. template - static std::shared_ptr> + static std::shared_ptr> createScatterHalo( const FieldManager_t& fm, MemorySpace ) { - return Cajita::createHalo( - Cajita::NodeHaloPattern(), + return Cabana::Grid::createHalo( + Cabana::Grid::NodeHaloPattern< + FieldManager_t::mesh_type::num_space_dim>(), -1, ( *fm.array( Layouts{} ) )... ); } @@ -278,7 +280,7 @@ struct GridOperatorDependencies, static void scatter( const Halo& halo, const FieldManager_t& fm, const ExecutionSpace& space ) { - halo->scatter( space, Cajita::ScatterReduce::Sum(), + halo->scatter( space, Cabana::Grid::ScatterReduce::Sum(), *( fm.array( Layouts{} ) )... ); } }; @@ -315,7 +317,7 @@ struct GridOperatorDependencies> // Create a halo for the gather fields. template - static std::shared_ptr> + static std::shared_ptr> createGatherHalo( const FieldManager_t&, MemorySpace ) { return nullptr; @@ -323,7 +325,7 @@ struct GridOperatorDependencies> // Create a halo for the scatter fields. template - static std::shared_ptr> + static std::shared_ptr> createScatterHalo( const FieldManager_t&, MemorySpace ) { return nullptr; @@ -477,8 +479,8 @@ class GridOperator createDependencies( fm, typename field_deps::local_dep_type() ); // Create local mesh. - auto local_mesh = - Cajita::createLocalMesh( *( _mesh->localGrid() ) ); + auto local_mesh = Cabana::Grid::createLocalMesh( + *( _mesh->localGrid() ) ); // Apply the operator. applyOp( label, local_mesh, gather_deps, scatter_deps, @@ -654,8 +656,8 @@ class GridOperator // geometric operations, gather, scatter, and local dependencies for // field operations (all of which may be empty), and the local ijk // index of the entity they are currently working on. - Cajita::grid_parallel_for( - label, exec_space, *( _mesh->localGrid() ), Cajita::Own(), + Cabana::Grid::grid_parallel_for( + label, exec_space, *( _mesh->localGrid() ), Cabana::Grid::Own(), typename Location::entity_type(), KOKKOS_LAMBDA( const int i, const int j, const int k ) { functorTagDispatch( func, local_mesh, gather_deps, @@ -680,8 +682,8 @@ class GridOperator // field operations (all of which may be empty), and the local ijk // index of the entity they are currently working on. auto grid = *( _mesh->localGrid() ); - Cajita::grid_parallel_for( - label, exec_space, grid, Cajita::Own(), + Cabana::Grid::grid_parallel_for( + label, exec_space, grid, Cabana::Grid::Own(), typename Location::entity_type(), KOKKOS_LAMBDA( const int i, const int j ) { functorTagDispatch( func, local_mesh, gather_deps, @@ -691,8 +693,8 @@ class GridOperator private: std::shared_ptr _mesh; - std::shared_ptr> _gather_halo; - std::shared_ptr> _scatter_halo; + std::shared_ptr> _gather_halo; + std::shared_ptr> _scatter_halo; }; //---------------------------------------------------------------------------// diff --git a/src/Picasso_LevelSet.hpp b/src/Picasso_LevelSet.hpp index 2677df1..249c016 100644 --- a/src/Picasso_LevelSet.hpp +++ b/src/Picasso_LevelSet.hpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include @@ -35,9 +35,10 @@ class LevelSet using memory_space = typename mesh_type::memory_space; using location_type = SignedDistanceLocation; using entity_type = typename location_type::entity_type; - using array_type = Cajita::Array, memory_space>; - using halo_type = Cajita::Halo; + using array_type = + Cabana::Grid::Array, memory_space>; + using halo_type = Cabana::Grid::Halo; /*! \brief Construct the level set over the given mesh. @@ -55,8 +56,8 @@ class LevelSet createArray( *_mesh, location_type(), Field::DistanceEstimate() ); _signed_distance = createArray( *_mesh, location_type(), Field::SignedDistance() ); - _halo = Cajita::createHalo( Cajita::NodeHaloPattern<3>(), -1, - *( _signed_distance ) ); + _halo = Cabana::Grid::createHalo( Cabana::Grid::NodeHaloPattern<3>(), + -1, *( _signed_distance ) ); // Cell size. _dx = _mesh->localGrid()->globalGrid().globalMesh().cellSize( 0 ); @@ -89,23 +90,23 @@ class LevelSet Kokkos::Profiling::pushRegion( "Picasso::LevelSet::redistance" ); // Local mesh. - auto local_mesh = - Cajita::createLocalMesh( *( _mesh->localGrid() ) ); + auto local_mesh = Cabana::Grid::createLocalMesh( + *( _mesh->localGrid() ) ); // Views. auto estimate_view = _distance_estimate->view(); auto distance_view = _signed_distance->view(); // Local-to-global indexer. - auto l2g = Cajita::IndexConversion::createL2G( *( _mesh->localGrid() ), - entity_type() ); + auto l2g = Cabana::Grid::IndexConversion::createL2G( + *( _mesh->localGrid() ), entity_type() ); // Gather to get updated ghost values. _halo->gather( exec_space, *_distance_estimate ); // Redistance on the coarse grid. auto own_entities = _mesh->localGrid()->indexSpace( - Cajita::Own(), entity_type(), Cajita::Local() ); + Cabana::Grid::Own(), entity_type(), Cabana::Grid::Local() ); double secant_tol = _redistance_secant_tol; int max_secant_iter = _redistance_max_secant_iter; @@ -115,7 +116,7 @@ class LevelSet Kokkos::parallel_for( "Picasso::LevelSet::RedistanceCoarse", - Cajita::createExecutionPolicy( own_entities, exec_space ), + Cabana::Grid::createExecutionPolicy( own_entities, exec_space ), KOKKOS_LAMBDA( const int i, const int j, const int k ) { // Get the global id of the entity. int gi, gj, gk; @@ -142,7 +143,7 @@ class LevelSet // Interpolate from coarse grid to fine grid. Kokkos::parallel_for( "Picasso::LevelSet::RedistanceInterpolate", - Cajita::createExecutionPolicy( own_entities, exec_space ), + Cabana::Grid::createExecutionPolicy( own_entities, exec_space ), KOKKOS_LAMBDA( const int i, const int j, const int k ) { // Get the global id of the entity. int gi, gj, gk; @@ -233,7 +234,7 @@ class LevelSet auto threshold = _dx * _mesh->localGrid()->haloCellWidth(); Kokkos::parallel_for( "Picasso::LevelSet::RedistanceFine", - Cajita::createExecutionPolicy( own_entities, exec_space ), + Cabana::Grid::createExecutionPolicy( own_entities, exec_space ), KOKKOS_LAMBDA( const int i, const int j, const int k ) { // Only redistance on the fine grid if the estimate is less // than the threshold distance. diff --git a/src/Picasso_LevelSetRedistance.hpp b/src/Picasso_LevelSetRedistance.hpp index a4c9dda..edb3bca 100644 --- a/src/Picasso_LevelSetRedistance.hpp +++ b/src/Picasso_LevelSetRedistance.hpp @@ -14,7 +14,7 @@ #include -#include +#include #include #include @@ -45,8 +45,8 @@ clampPointToLocalDomain( const LocalMeshType& local_mesh, const double dx, for ( int d = 0; d < 3; ++d ) { x[d] = Kokkos::fmin( - local_mesh.highCorner( Cajita::Ghost(), d ) - 0.001 * dx, - Kokkos::fmax( local_mesh.lowCorner( Cajita::Ghost(), d ) + + local_mesh.highCorner( Cabana::Grid::Ghost(), d ) - 0.001 * dx, + Kokkos::fmax( local_mesh.lowCorner( Cabana::Grid::Ghost(), d ) + 0.001 * dx, x[d] ) ); } @@ -80,7 +80,7 @@ evaluate( const SignedDistanceView& phi_0, const double sign, double y[3] ) { // Get the cell size. We assume a uniform cell size in this implementation. - Cajita::evaluateSpline( local_mesh, y, sd ); + Cabana::Grid::evaluateSpline( local_mesh, y, sd ); double sign_dx = sign * sd.dx[0]; // Perform gradient projections to get the minimum argument on the ball. @@ -94,8 +94,8 @@ evaluate( const SignedDistanceView& phi_0, const double sign, clampPointToLocalDomain( local_mesh, sd.dx[0], y_old ); // Do a gradient projection. - Cajita::evaluateSpline( local_mesh, y_old, sd ); - Cajita::G2P::gradient( phi_0, sd, grad_phi_0 ); + Cabana::Grid::evaluateSpline( local_mesh, y_old, sd ); + Cabana::Grid::G2P::gradient( phi_0, sd, grad_phi_0 ); for ( int d = 0; d < 3; ++d ) y[d] = y_old[d] - sign_dx * grad_phi_0[d]; @@ -120,8 +120,8 @@ evaluate( const SignedDistanceView& phi_0, const double sign, // Evaluate the signed distance function at the minimum argument. clampPointToLocalDomain( local_mesh, sd.dx[0], y ); double phi_argmin_eval; - Cajita::evaluateSpline( local_mesh, y, sd ); - Cajita::G2P::value( phi_0, sd, phi_argmin_eval ); + Cabana::Grid::evaluateSpline( local_mesh, y, sd ); + Cabana::Grid::G2P::value( phi_0, sd, phi_argmin_eval ); return sign * phi_argmin_eval; } @@ -209,11 +209,11 @@ redistanceEntity( EntityType, const SignedDistanceView& phi_0, const int max_projection_iter ) { // Grid interpolant. - using SplineTags = - Cajita::SplineDataMemberTypes; - Cajita::SplineData sd; + using SplineTags = Cabana::Grid::SplineDataMemberTypes< + Cabana::Grid::SplineWeightValues, + Cabana::Grid::SplineWeightPhysicalGradients, + Cabana::Grid::SplinePhysicalCellSize>; + Cabana::Grid::SplineData sd; // Random number generator. using rand_type = @@ -226,7 +226,7 @@ redistanceEntity( EntityType, const SignedDistanceView& phi_0, // Uniform mesh spacing. int low_id[3] = { 0, 0, 0 }; - double dx = local_mesh.measure( Cajita::Edge(), low_id ); + double dx = local_mesh.measure( Cabana::Grid::Edge(), low_id ); // Initial guess. The signed distance estimate is the phi value at time // zero. diff --git a/src/Picasso_MarchingCubes.hpp b/src/Picasso_MarchingCubes.hpp index e8d7bc9..87c9489 100644 --- a/src/Picasso_MarchingCubes.hpp +++ b/src/Picasso_MarchingCubes.hpp @@ -14,7 +14,7 @@ #include -#include +#include #include @@ -57,8 +57,9 @@ struct Data template Data( const Mesh& mesh ) { - auto cell_space = mesh.localGrid()->indexSpace( - Cajita::Ghost{}, Cajita::Cell{}, Cajita::Local{} ); + auto cell_space = mesh.localGrid()->indexSpace( Cabana::Grid::Ghost{}, + Cabana::Grid::Cell{}, + Cabana::Grid::Local{} ); cell_case_ids_and_offsets = Kokkos::View( @@ -1026,12 +1027,13 @@ vertexLocations( const LocalMesh& local_mesh, const int i, const int j, const int k, Kokkos::Array& vertex_locations ) { int index[3] = { i, j, k }; - local_mesh.coordinates( Cajita::Node{}, index, vertex_locations.data() ); + local_mesh.coordinates( Cabana::Grid::Node{}, index, + vertex_locations.data() ); for ( int d = 0; d < 3; ++d ) { ++index[d]; } - local_mesh.coordinates( Cajita::Node{}, index, + local_mesh.coordinates( Cabana::Grid::Node{}, index, vertex_locations.data() + 3 ); for ( int d = 0; d < 3; ++d ) { @@ -1131,7 +1133,7 @@ void build( const ExecutionSpace& exec_space, const Mesh& mesh, Kokkos::Profiling::pushRegion( "Picasso::MarchingCubes::build" ); static_assert( std::is_same::value, + Cabana::Grid::Node>::value, "Marching cubes facets may only be constructed from nodal " "distance fields" ); @@ -1143,11 +1145,11 @@ void build( const ExecutionSpace& exec_space, const Mesh& mesh, // Get the cell space we are working on. auto cell_space = signed_distance.layout()->localGrid()->indexSpace( - Cajita::Own{}, Cajita::Cell{}, Cajita::Local{} ); + Cabana::Grid::Own{}, Cabana::Grid::Cell{}, Cabana::Grid::Local{} ); // Get the case id and number of facets for each cell. data.num_facet = 0; - Cajita::grid_parallel_reduce( + Cabana::Grid::grid_parallel_reduce( "marching_cubes_facet_count", exec_space, cell_space, KOKKOS_LAMBDA( const int i, const int j, const int k, int& result ) { Kokkos::Array vertex_data; @@ -1193,8 +1195,8 @@ void build( const ExecutionSpace& exec_space, const Mesh& mesh, // Fill facets. auto local_mesh = - Cajita::createLocalMesh( *( mesh.localGrid() ) ); - Cajita::grid_parallel_for( + Cabana::Grid::createLocalMesh( *( mesh.localGrid() ) ); + Cabana::Grid::grid_parallel_for( "marching_cubes_fill_facets", exec_space, cell_space, KOKKOS_LAMBDA( const int i, const int j, const int k ) { int case_id = data.cell_case_ids_and_offsets( i, j, k, 0 ); diff --git a/src/Picasso_ParticleInit.hpp b/src/Picasso_ParticleInit.hpp index 9db4ed3..868b7d5 100644 --- a/src/Picasso_ParticleInit.hpp +++ b/src/Picasso_ParticleInit.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include @@ -135,14 +135,15 @@ void initializeParticles( InitRandom, const ExecutionSpace& exec_space, const auto& local_grid = *( mesh->localGrid() ); // Create a local mesh. - auto local_mesh = Cajita::createLocalMesh( local_grid ); + auto local_mesh = + Cabana::Grid::createLocalMesh( local_grid ); // Get the global grid. const auto& global_grid = local_grid.globalGrid(); // Get the local set of owned cell indices. - auto owned_cells = - local_grid.indexSpace( Cajita::Own(), Cajita::Cell(), Cajita::Local() ); + auto owned_cells = local_grid.indexSpace( + Cabana::Grid::Own(), Cabana::Grid::Cell(), Cabana::Grid::Local() ); // Create a random number generator. uint64_t seed = @@ -169,7 +170,7 @@ void initializeParticles( InitRandom, const ExecutionSpace& exec_space, int local_num_create = 0; Kokkos::parallel_reduce( "Picasso::ParticleInit::Random", - Cajita::createExecutionPolicy( owned_cells, exec_space ), + Cabana::Grid::createExecutionPolicy( owned_cells, exec_space ), KOKKOS_LAMBDA( const int i, const int j, const int k, int& create_count ) { // Compute the owned local cell id. @@ -183,12 +184,14 @@ void initializeParticles( InitRandom, const ExecutionSpace& exec_space, // Get the coordinates of the low cell node. int low_node[3] = { i, j, k }; double low_coords[3]; - local_mesh.coordinates( Cajita::Node(), low_node, low_coords ); + local_mesh.coordinates( Cabana::Grid::Node(), low_node, + low_coords ); // Get the coordinates of the high cell node. int high_node[3] = { i + 1, j + 1, k + 1 }; double high_coords[3]; - local_mesh.coordinates( Cajita::Node(), high_node, high_coords ); + local_mesh.coordinates( Cabana::Grid::Node(), high_node, + high_coords ); // Random number generator. auto rand = pool.get_state( cell_id ); @@ -201,7 +204,7 @@ void initializeParticles( InitRandom, const ExecutionSpace& exec_space, // overload which gets the nodes and computes the volume. We will // still place particles uniformly in the logical space but we // will then need to map them back to the reference space later. - double pv = local_mesh.measure( Cajita::Cell(), low_node ) / + double pv = local_mesh.measure( Cabana::Grid::Cell(), low_node ) / particles_per_cell; // Particle. @@ -304,11 +307,12 @@ void initializeParticles( InitUniform, const ExecutionSpace& exec_space, const auto& local_grid = *( mesh->localGrid() ); // Create a local mesh. - auto local_mesh = Cajita::createLocalMesh( local_grid ); + auto local_mesh = + Cabana::Grid::createLocalMesh( local_grid ); // Get the local set of owned cell indices. - auto owned_cells = - local_grid.indexSpace( Cajita::Own(), Cajita::Cell(), Cajita::Local() ); + auto owned_cells = local_grid.indexSpace( + Cabana::Grid::Own(), Cabana::Grid::Cell(), Cabana::Grid::Local() ); // Get the particles. auto& particles = particle_list.aosoa(); @@ -330,7 +334,7 @@ void initializeParticles( InitUniform, const ExecutionSpace& exec_space, int local_num_create = 0; Kokkos::parallel_reduce( "Picasso::ParticleInit::Uniform", - Cajita::createExecutionPolicy( owned_cells, exec_space ), + Cabana::Grid::createExecutionPolicy( owned_cells, exec_space ), KOKKOS_LAMBDA( const int i, const int j, const int k, int& create_count ) { // Compute the owned local cell id. @@ -344,12 +348,14 @@ void initializeParticles( InitUniform, const ExecutionSpace& exec_space, // Get the coordinates of the low cell node. int low_node[3] = { i, j, k }; double low_coords[3]; - local_mesh.coordinates( Cajita::Node(), low_node, low_coords ); + local_mesh.coordinates( Cabana::Grid::Node(), low_node, + low_coords ); // Get the coordinates of the high cell node. int high_node[3] = { i + 1, j + 1, k + 1 }; double high_coords[3]; - local_mesh.coordinates( Cajita::Node(), high_node, high_coords ); + local_mesh.coordinates( Cabana::Grid::Node(), high_node, + high_coords ); // Compute the particle spacing in each dimension. double spacing[3] = { ( high_coords[Dim::I] - low_coords[Dim::I] ) / @@ -368,7 +374,7 @@ void initializeParticles( InitUniform, const ExecutionSpace& exec_space, // still place particles uniformly in the logical space but we // will then need to map them back to the reference space // later. - double pv = local_mesh.measure( Cajita::Cell(), low_node ) / + double pv = local_mesh.measure( Cabana::Grid::Cell(), low_node ) / particles_per_cell; // Particle. @@ -486,7 +492,8 @@ void initializeParticlesSurface( InitRandom, const ExecutionSpace&, const auto& local_grid = *( mesh->localGrid() ); // Create a local mesh. - auto local_mesh = Cajita::createLocalMesh( local_grid ); + auto local_mesh = + Cabana::Grid::createLocalMesh( local_grid ); // Get the global grid. const auto& global_grid = local_grid.globalGrid(); diff --git a/src/Picasso_ParticleInterpolation.hpp b/src/Picasso_ParticleInterpolation.hpp index 336665d..fa41a0c 100644 --- a/src/Picasso_ParticleInterpolation.hpp +++ b/src/Picasso_ParticleInterpolation.hpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include @@ -36,35 +36,35 @@ struct InterpolationOrder // Indicates that the spline data should include the weight values. struct SplineValue { - using spline_data_member = Cajita::SplineWeightValues; + using spline_data_member = Cabana::Grid::SplineWeightValues; }; // Indicates that the spline data should include the gradient of the weight // values in the physical frame. struct SplineGradient { - using spline_data_member = Cajita::SplineWeightPhysicalGradients; + using spline_data_member = Cabana::Grid::SplineWeightPhysicalGradients; }; // Indicates that the spline data should include the physical distance between // the particle and the entities in the interpolation stencil struct SplineDistance { - using spline_data_member = Cajita::SplinePhysicalDistance; + using spline_data_member = Cabana::Grid::SplinePhysicalDistance; }; // Indicates that the spline data should include the physical size of the cell // in each direction. struct SplineCellSize { - using spline_data_member = Cajita::SplinePhysicalCellSize; + using spline_data_member = Cabana::Grid::SplinePhysicalCellSize; }; // Indicates that the spline data should include the position of the particle // in the reference frame of the spline stencil. struct SplineLogicalPosition { - using spline_data_member = Cajita::SplineLogicalPosition; + using spline_data_member = Cabana::Grid::SplineLogicalPosition; }; //---------------------------------------------------------------------------// @@ -95,12 +95,12 @@ createSpline( Location, Order, const LocalMesh& local_mesh, // operator() of the input point data for interpolation. typename PositionVector::value_type x[3] = { position( 0 ), position( 1 ), position( 2 ) }; - Cajita::SplineData> + Cabana::Grid::SplineData> sd; - Cajita::evaluateSpline( local_mesh, x, sd ); + Cabana::Grid::evaluateSpline( local_mesh, x, sd ); return sd; } @@ -117,7 +117,7 @@ template KOKKOS_INLINE_FUNCTION void divergence( const SplineDataType& sd, const ViewType& view, Scalar& result ) { - Cajita::G2P::divergence( view, sd, result ); + Cabana::Grid::G2P::divergence( view, sd, result ); } //---------------------------------------------------------------------------// @@ -208,7 +208,7 @@ KOKKOS_INLINE_FUNCTION void value( const SplineDataType& sd, const Scalar& value, const ScatterViewType& view ) { - Cajita::P2G::value( value, sd, view ); + Cabana::Grid::P2G::value( value, sd, view ); } //---------------------------------------------------------------------------// @@ -224,7 +224,7 @@ KOKKOS_INLINE_FUNCTION void value( const SplineDataType& sd, // operator() of the input point data for interpolation. typename ValueVector::value_type v[3] = { value( 0 ), value( 1 ), value( 2 ) }; - Cajita::P2G::value( v, sd, view ); + Cabana::Grid::P2G::value( v, sd, view ); } //---------------------------------------------------------------------------// @@ -235,7 +235,7 @@ KOKKOS_INLINE_FUNCTION void gradient( const SplineDataType& sd, const Scalar& value, const ScatterViewType& view ) { - Cajita::P2G::gradient( value, sd, view ); + Cabana::Grid::P2G::gradient( value, sd, view ); } //---------------------------------------------------------------------------// @@ -252,7 +252,7 @@ KOKKOS_INLINE_FUNCTION void divergence( const SplineDataType& sd, // operator() of the input point data for interpolation. typename ValueVector::value_type v[3] = { value( 0 ), value( 1 ), value( 2 ) }; - Cajita::P2G::divergence( v, sd, view ); + Cabana::Grid::P2G::divergence( v, sd, view ); } //---------------------------------------------------------------------------// @@ -271,7 +271,7 @@ KOKKOS_INLINE_FUNCTION void divergence( const SplineDataType& sd, { value( 0, 0 ), value( 0, 1 ), value( 0, 2 ) }, { value( 1, 0 ), value( 1, 1 ), value( 1, 2 ) }, { value( 2, 0 ), value( 2, 1 ), value( 2, 2 ) } }; - Cajita::P2G::divergence( v, sd, view ); + Cabana::Grid::P2G::divergence( v, sd, view ); } //---------------------------------------------------------------------------// diff --git a/src/Picasso_ParticleLevelSet.hpp b/src/Picasso_ParticleLevelSet.hpp index 5f6bae8..4685d32 100644 --- a/src/Picasso_ParticleLevelSet.hpp +++ b/src/Picasso_ParticleLevelSet.hpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include @@ -74,7 +74,7 @@ struct ParticleLevelSetPredicateData : local_mesh( lm ) { auto ghost_entities = local_grid.indexSpace( - Cajita::Ghost(), entity_type(), Cajita::Local() ); + Cabana::Grid::Ghost(), entity_type(), Cabana::Grid::Local() ); size = ghost_entities.size(); i_size = ghost_entities.extent( Dim::I ); ij_size = i_size * ghost_entities.extent( Dim::J ); @@ -208,7 +208,7 @@ class ParticleLevelSet using memory_space = typename mesh_type::memory_space; using location_type = SignedDistanceLocation; using entity_type = typename location_type::entity_type; - using halo_type = Cajita::Halo; + using halo_type = Cabana::Grid::Halo; using level_set = LevelSet; /*! @@ -337,7 +337,8 @@ class ParticleLevelSet // Local mesh. auto local_grid = distance_estimate->layout()->localGrid(); - auto local_mesh = Cajita::createLocalMesh( *local_grid ); + auto local_mesh = + Cabana::Grid::createLocalMesh( *local_grid ); // If we have no particles of the given color on this rank then we are // in a region of positive distance. Estimate the signed distance @@ -347,8 +348,8 @@ class ParticleLevelSet if ( 0 == _color_count ) { double min_dist = _dx * local_grid->haloCellWidth(); - Cajita::ArrayOp::assign( *distance_estimate, min_dist, - Cajita::Ghost() ); + Cabana::Grid::ArrayOp::assign( *distance_estimate, min_dist, + Cabana::Grid::Ghost() ); } // Otherwise we have particles so build a tree from the particles of @@ -385,7 +386,7 @@ class ParticleLevelSet // Do a reduction to get the minimum distance within the minimum halo // width. - _ls->getHalo()->scatter( exec_space, Cajita::ScatterReduce::Min(), + _ls->getHalo()->scatter( exec_space, Cabana::Grid::ScatterReduce::Min(), *distance_estimate ); Kokkos::Profiling::popRegion(); diff --git a/src/Picasso_ParticleList.hpp b/src/Picasso_ParticleList.hpp index 3ef842e..9eca0f6 100644 --- a/src/Picasso_ParticleList.hpp +++ b/src/Picasso_ParticleList.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include diff --git a/src/Picasso_PolyPIC.hpp b/src/Picasso_PolyPIC.hpp index f546fae..b2641e9 100644 --- a/src/Picasso_PolyPIC.hpp +++ b/src/Picasso_PolyPIC.hpp @@ -12,7 +12,7 @@ #ifndef PICASSO_POLYPIC_HPP #define PICASSO_POLYPIC_HPP -#include +#include #include #include @@ -38,21 +38,22 @@ namespace PolyPIC // functions and PolyPIC decomposition as the field to be reconstructed. template -KOKKOS_INLINE_FUNCTION void -p2g( const ParticleMass& m_p, const ParticleVelocity& u_p, - const ParticleField& c_p, const GridField& mu_i, const GridMass& m_i, - const double dt, const SplineDataType& sd, - typename std::enable_if< - ( ( Cajita::isNode::value || - Cajita::isCell::value ) && - SplineDataType::order == 1 ), - void*>::type = 0 ) +KOKKOS_INLINE_FUNCTION void p2g( + const ParticleMass& m_p, const ParticleVelocity& u_p, + const ParticleField& c_p, const GridField& mu_i, const GridMass& m_i, + const double dt, const SplineDataType& sd, + typename std::enable_if< + ( ( Cabana::Grid::isNode::value || + Cabana::Grid::isCell< + typename SplineDataType::entity_type>::value ) && + SplineDataType::order == 1 ), + void*>::type = 0 ) { - static_assert( Cajita::P2G::is_scatter_view::value, + static_assert( Cabana::Grid::P2G::is_scatter_view::value, "P2G requires a Kokkos::ScatterView" ); auto field_access = mu_i.access(); - static_assert( Cajita::P2G::is_scatter_view::value, + static_assert( Cabana::Grid::P2G::is_scatter_view::value, "P2G requires a Kokkos::ScatterView" ); auto mass_access = m_i.access(); @@ -136,21 +137,22 @@ p2g( const ParticleMass& m_p, const ParticleVelocity& u_p, // functions and PolyPIC decomposition as the field to be reconstructed. template -KOKKOS_INLINE_FUNCTION void -p2g( const ParticleMass& m_p, const ParticleVelocity& u_p, - const ParticleField& c_p, const GridField& mu_i, const GridMass& m_i, - const double dt, const SplineDataType& sd, - typename std::enable_if< - ( ( Cajita::isFace::value || - Cajita::isEdge::value ) && - SplineDataType::order == 1 ), - void*>::type = 0 ) +KOKKOS_INLINE_FUNCTION void p2g( + const ParticleMass& m_p, const ParticleVelocity& u_p, + const ParticleField& c_p, const GridField& mu_i, const GridMass& m_i, + const double dt, const SplineDataType& sd, + typename std::enable_if< + ( ( Cabana::Grid::isFace::value || + Cabana::Grid::isEdge< + typename SplineDataType::entity_type>::value ) && + SplineDataType::order == 1 ), + void*>::type = 0 ) { - static_assert( Cajita::P2G::is_scatter_view::value, + static_assert( Cabana::Grid::P2G::is_scatter_view::value, "P2G requires a Kokkos::ScatterView" ); auto field_access = mu_i.access(); - static_assert( Cajita::P2G::is_scatter_view::value, + static_assert( Cabana::Grid::P2G::is_scatter_view::value, "P2G requires a Kokkos::ScatterView" ); auto mass_access = m_i.access(); @@ -231,13 +233,14 @@ p2g( const ParticleMass& m_p, const ParticleVelocity& u_p, // splines). Requires SplineValue and SplineGradient when constructing the // spline data. template -KOKKOS_INLINE_FUNCTION void -g2p( const GridField& u_i, ParticleField& c_p, const SplineDataType& sd, - typename std::enable_if< - ( ( Cajita::isNode::value || - Cajita::isCell::value ) && - SplineDataType::order == 1 ), - void*>::type = 0 ) +KOKKOS_INLINE_FUNCTION void g2p( + const GridField& u_i, ParticleField& c_p, const SplineDataType& sd, + typename std::enable_if< + ( ( Cabana::Grid::isNode::value || + Cabana::Grid::isCell< + typename SplineDataType::entity_type>::value ) && + SplineDataType::order == 1 ), + void*>::type = 0 ) { using value_type = typename GridField::value_type; @@ -294,13 +297,14 @@ g2p( const GridField& u_i, ParticleField& c_p, const SplineDataType& sd, // splines). Requires SplineValue and SplineGradient when constructing the // spline data. template -KOKKOS_INLINE_FUNCTION void -g2p( const GridField& u_i, ParticleField& c_p, const SplineDataType& sd, - typename std::enable_if< - ( ( Cajita::isFace::value || - Cajita::isEdge::value ) && - SplineDataType::order == 1 ), - void*>::type = 0 ) +KOKKOS_INLINE_FUNCTION void g2p( + const GridField& u_i, ParticleField& c_p, const SplineDataType& sd, + typename std::enable_if< + ( ( Cabana::Grid::isFace::value || + Cabana::Grid::isEdge< + typename SplineDataType::entity_type>::value ) && + SplineDataType::order == 1 ), + void*>::type = 0 ) { using value_type = typename GridField::value_type; diff --git a/src/Picasso_Types.hpp b/src/Picasso_Types.hpp index a326f03..8850296 100644 --- a/src/Picasso_Types.hpp +++ b/src/Picasso_Types.hpp @@ -12,7 +12,7 @@ #ifndef PICASSO_TYPES_HPP #define PICASSO_TYPES_HPP -#include +#include #include #include @@ -21,7 +21,7 @@ namespace Picasso { //---------------------------------------------------------------------------// // Logical dimension index. -using Dim = Cajita::Dim; +using Dim = Cabana::Grid::Dim; //---------------------------------------------------------------------------// // Spatial dimension selector. diff --git a/src/Picasso_UniformCartesianMeshMapping.hpp b/src/Picasso_UniformCartesianMeshMapping.hpp index 63e928f..68f8122 100644 --- a/src/Picasso_UniformCartesianMeshMapping.hpp +++ b/src/Picasso_UniformCartesianMeshMapping.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include diff --git a/src/Picasso_UniformMesh.hpp b/src/Picasso_UniformMesh.hpp index 71113b5..64171c6 100644 --- a/src/Picasso_UniformMesh.hpp +++ b/src/Picasso_UniformMesh.hpp @@ -12,7 +12,7 @@ #ifndef PICASSO_UNIFORMMESH_HPP #define PICASSO_UNIFORMMESH_HPP -#include +#include #include @@ -33,14 +33,16 @@ template class UniformMesh { public: - using cajita_mesh = Cajita::UniformMesh; + using cabana_mesh = Cabana::Grid::UniformMesh; + using cajita_mesh [[deprecated]] = cabana_mesh; using memory_space = MemorySpace; - using local_grid = Cajita::LocalGrid; + using local_grid = Cabana::Grid::LocalGrid; - using node_array = Cajita::Array, MemorySpace>; + using node_array = + Cabana::Grid::Array, MemorySpace>; static constexpr std::size_t num_space_dim = 3; @@ -164,16 +166,17 @@ class UniformMesh } // Create the global mesh. - auto global_mesh = Cajita::createUniformGlobalMesh( + auto global_mesh = Cabana::Grid::createUniformGlobalMesh( global_low_corner, global_high_corner, global_num_cell ); // Create the partitioner. const auto& part_params = mesh_params.get_child( "partitioner" ); - std::shared_ptr> partitioner; + std::shared_ptr> partitioner; if ( part_params.get( "type" ).compare( "uniform_dim" ) == 0 ) { - partitioner = std::make_shared>(); + partitioner = + std::make_shared>(); } else if ( part_params.get( "type" ).compare( "manual" ) == 0 ) @@ -189,13 +192,14 @@ class UniformMesh ranks_per_dim[d] = element.second.get_value(); ++d; } - partitioner = std::make_shared>( - ranks_per_dim ); + partitioner = + std::make_shared>( + ranks_per_dim ); } // Build the global grid. - auto global_grid = Cajita::createGlobalGrid( comm, global_mesh, - periodic, *partitioner ); + auto global_grid = Cabana::Grid::createGlobalGrid( + comm, global_mesh, periodic, *partitioner ); // Get the halo cell width. If the user does not assign one then it is // assumed the minimum halo cell width will be used. @@ -203,7 +207,8 @@ class UniformMesh _minimum_halo_width, mesh_params.get( "halo_cell_width", 0 ) ); // Build the local grid. - _local_grid = Cajita::createLocalGrid( global_grid, halo_cell_width ); + _local_grid = + Cabana::Grid::createLocalGrid( global_grid, halo_cell_width ); // Create the nodes. buildNodes( cell_size, exec_space ); @@ -233,25 +238,29 @@ class UniformMesh { // Create both owned and ghosted nodes so we don't have to gather // initially. - auto node_layout = - Cajita::createArrayLayout( _local_grid, 3, Cajita::Node() ); - _nodes = Cajita::createArray( "mesh_nodes", - node_layout ); + auto node_layout = Cabana::Grid::createArrayLayout( + _local_grid, 3, Cabana::Grid::Node() ); + _nodes = Cabana::Grid::createArray( "mesh_nodes", + node_layout ); auto node_view = _nodes->view(); auto local_mesh = - Cajita::createLocalMesh( *_local_grid ); - auto local_space = _local_grid->indexSpace( - Cajita::Ghost(), Cajita::Node(), Cajita::Local() ); + Cabana::Grid::createLocalMesh( *_local_grid ); + auto local_space = _local_grid->indexSpace( Cabana::Grid::Ghost(), + Cabana::Grid::Node(), + Cabana::Grid::Local() ); Kokkos::parallel_for( "Picasso::UniformMesh::create_nodes", - Cajita::createExecutionPolicy( local_space, exec_space ), + Cabana::Grid::createExecutionPolicy( local_space, exec_space ), KOKKOS_LAMBDA( const int i, const int j, const int k ) { node_view( i, j, k, 0 ) = - local_mesh.lowCorner( Cajita::Ghost(), 0 ) + i * cell_size; + local_mesh.lowCorner( Cabana::Grid::Ghost(), 0 ) + + i * cell_size; node_view( i, j, k, 1 ) = - local_mesh.lowCorner( Cajita::Ghost(), 1 ) + j * cell_size; + local_mesh.lowCorner( Cabana::Grid::Ghost(), 1 ) + + j * cell_size; node_view( i, j, k, 2 ) = - local_mesh.lowCorner( Cajita::Ghost(), 2 ) + k * cell_size; + local_mesh.lowCorner( Cabana::Grid::Ghost(), 2 ) + + k * cell_size; } ); } diff --git a/unit_test/tstAPIC.hpp b/unit_test/tstAPIC.hpp index 3230063..887cc7f 100644 --- a/unit_test/tstAPIC.hpp +++ b/unit_test/tstAPIC.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include @@ -552,7 +552,7 @@ void collocatedTest() UniformMesh mesh( ptree, global_box, minimum_halo_size, MPI_COMM_WORLD ); auto local_mesh = - Cajita::createLocalMesh( *( mesh.localGrid() ) ); + Cabana::Grid::createLocalMesh( *( mesh.localGrid() ) ); // Particle mass. double pm = 0.134; @@ -575,9 +575,10 @@ void collocatedTest() // Initialize the grid vector. auto gv_view = grid_vector->view(); - Cajita::grid_parallel_for( + Cabana::Grid::grid_parallel_for( "fill_grid_vector", TEST_EXECSPACE(), - grid_vector->layout()->indexSpace( Cajita::Own(), Cajita::Local() ), + grid_vector->layout()->indexSpace( Cabana::Grid::Own(), + Cabana::Grid::Local() ), KOKKOS_LAMBDA( const int i, const int j, const int k, const int d ) { int ic = i - 2; int jc = j - 2; @@ -697,7 +698,7 @@ void staggeredTest() // If we are using edges offset the non-test dimensions to align with the // mathematica grid. - if ( Cajita::isEdge::value ) + if ( Cabana::Grid::isEdge::value ) for ( int d = 0; d < 3; ++d ) { if ( d != Dim ) @@ -709,7 +710,7 @@ void staggeredTest() // If we are using faces offset that dimension to align with the // mathematica grid for the quadratic functions. - else if ( Cajita::isFace::value ) + else if ( Cabana::Grid::isFace::value ) { global_box[Dim] += 0.25; global_box[Dim + 3] += 0.25; @@ -724,7 +725,7 @@ void staggeredTest() UniformMesh mesh( ptree, global_box, minimum_halo_size, MPI_COMM_WORLD ); auto local_mesh = - Cajita::createLocalMesh( *( mesh.localGrid() ) ); + Cabana::Grid::createLocalMesh( *( mesh.localGrid() ) ); // Particle mass. double pm = 0.134; @@ -747,9 +748,10 @@ void staggeredTest() // Initialize the grid scalar. auto gs_view = grid_scalar->view(); - Cajita::grid_parallel_for( + Cabana::Grid::grid_parallel_for( "fill_grid_scalar", TEST_EXECSPACE(), - grid_scalar->layout()->indexSpace( Cajita::Own(), Cajita::Local() ), + grid_scalar->layout()->indexSpace( Cabana::Grid::Own(), + Cabana::Grid::Local() ), KOKKOS_LAMBDA( const int i, const int j, const int k, const int ) { int ic = i - 2; int jc = j - 2; diff --git a/unit_test/tstAdaptiveMesh.hpp b/unit_test/tstAdaptiveMesh.hpp index 60b21b2..c36fe97 100644 --- a/unit_test/tstAdaptiveMesh.hpp +++ b/unit_test/tstAdaptiveMesh.hpp @@ -15,6 +15,7 @@ #include +#include #include #include @@ -55,10 +56,12 @@ void constructionTest() EXPECT_EQ( global_mesh_1.highCorner( 1 ), num_cell + 1 ); EXPECT_EQ( global_mesh_1.highCorner( 2 ), num_cell ); - EXPECT_EQ( global_grid_1.globalNumEntity( Cajita::Cell(), 0 ), num_cell ); - EXPECT_EQ( global_grid_1.globalNumEntity( Cajita::Cell(), 1 ), + EXPECT_EQ( global_grid_1.globalNumEntity( Cabana::Grid::Cell(), 0 ), + num_cell ); + EXPECT_EQ( global_grid_1.globalNumEntity( Cabana::Grid::Cell(), 1 ), num_cell + 2 ); - EXPECT_EQ( global_grid_1.globalNumEntity( Cajita::Cell(), 2 ), num_cell ); + EXPECT_EQ( global_grid_1.globalNumEntity( Cabana::Grid::Cell(), 2 ), + num_cell ); EXPECT_TRUE( global_grid_1.isPeriodic( 0 ) ); EXPECT_FALSE( global_grid_1.isPeriodic( 1 ) ); @@ -71,8 +74,8 @@ void constructionTest() auto host_coords_1 = Kokkos::create_mirror_view_and_copy( Kokkos::HostSpace(), nodes_1->view() ); auto local_space_1 = nodes_1->layout()->localGrid()->indexSpace( - Cajita::Ghost(), Cajita::Node(), Cajita::Local() ); - auto local_mesh_1 = Cajita::createLocalMesh( + Cabana::Grid::Ghost(), Cabana::Grid::Node(), Cabana::Grid::Local() ); + auto local_mesh_1 = Cabana::Grid::createLocalMesh( *( nodes_1->layout()->localGrid() ) ); for ( int i = local_space_1.min( 0 ); i < local_space_1.max( 0 ); ++i ) for ( int j = local_space_1.min( 1 ); j < local_space_1.max( 1 ); ++j ) @@ -80,13 +83,13 @@ void constructionTest() ++k ) { EXPECT_EQ( host_coords_1( i, j, k, 0 ), - local_mesh_1.lowCorner( Cajita::Ghost(), 0 ) + + local_mesh_1.lowCorner( Cabana::Grid::Ghost(), 0 ) + i * cell_size ); EXPECT_EQ( host_coords_1( i, j, k, 1 ), - local_mesh_1.lowCorner( Cajita::Ghost(), 1 ) + + local_mesh_1.lowCorner( Cabana::Grid::Ghost(), 1 ) + j * cell_size ); EXPECT_EQ( host_coords_1( i, j, k, 2 ), - local_mesh_1.lowCorner( Cajita::Ghost(), 2 ) + + local_mesh_1.lowCorner( Cabana::Grid::Ghost(), 2 ) + k * cell_size ); } @@ -110,10 +113,11 @@ void constructionTest() EXPECT_EQ( global_mesh_2.highCorner( 1 ), num_cell ); EXPECT_EQ( global_mesh_2.highCorner( 2 ), num_cell + 1 ); - EXPECT_EQ( global_grid_2.globalNumEntity( Cajita::Cell(), 0 ), + EXPECT_EQ( global_grid_2.globalNumEntity( Cabana::Grid::Cell(), 0 ), num_cell + 2 ); - EXPECT_EQ( global_grid_2.globalNumEntity( Cajita::Cell(), 1 ), num_cell ); - EXPECT_EQ( global_grid_2.globalNumEntity( Cajita::Cell(), 2 ), + EXPECT_EQ( global_grid_2.globalNumEntity( Cabana::Grid::Cell(), 1 ), + num_cell ); + EXPECT_EQ( global_grid_2.globalNumEntity( Cabana::Grid::Cell(), 2 ), num_cell + 2 ); EXPECT_FALSE( global_grid_2.isPeriodic( 0 ) ); @@ -127,8 +131,8 @@ void constructionTest() auto host_coords_2 = Kokkos::create_mirror_view_and_copy( Kokkos::HostSpace(), nodes_2->view() ); auto local_space_2 = nodes_2->layout()->localGrid()->indexSpace( - Cajita::Ghost(), Cajita::Node(), Cajita::Local() ); - auto local_mesh_2 = Cajita::createLocalMesh( + Cabana::Grid::Ghost(), Cabana::Grid::Node(), Cabana::Grid::Local() ); + auto local_mesh_2 = Cabana::Grid::createLocalMesh( *( nodes_2->layout()->localGrid() ) ); for ( int i = local_space_2.min( 0 ); i < local_space_2.max( 0 ); ++i ) for ( int j = local_space_2.min( 1 ); j < local_space_2.max( 1 ); ++j ) @@ -136,13 +140,13 @@ void constructionTest() ++k ) { EXPECT_EQ( host_coords_2( i, j, k, 0 ), - local_mesh_2.lowCorner( Cajita::Ghost(), 0 ) + + local_mesh_2.lowCorner( Cabana::Grid::Ghost(), 0 ) + i * cell_size ); EXPECT_EQ( host_coords_2( i, j, k, 1 ), - local_mesh_2.lowCorner( Cajita::Ghost(), 1 ) + + local_mesh_2.lowCorner( Cabana::Grid::Ghost(), 1 ) + j * cell_size ); EXPECT_EQ( host_coords_2( i, j, k, 2 ), - local_mesh_2.lowCorner( Cajita::Ghost(), 2 ) + + local_mesh_2.lowCorner( Cabana::Grid::Ghost(), 2 ) + k * cell_size ); } } diff --git a/unit_test/tstBilinearMeshMapping.hpp b/unit_test/tstBilinearMeshMapping.hpp index 77d69b2..6f25791 100644 --- a/unit_test/tstBilinearMeshMapping.hpp +++ b/unit_test/tstBilinearMeshMapping.hpp @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -68,9 +69,12 @@ void mappingTest3d() EXPECT_EQ( global_mesh.highCorner( 1 ), num_cell ); EXPECT_EQ( global_mesh.highCorner( 2 ), num_cell ); - EXPECT_EQ( global_grid.globalNumEntity( Cajita::Cell(), 0 ), num_cell ); - EXPECT_EQ( global_grid.globalNumEntity( Cajita::Cell(), 1 ), num_cell ); - EXPECT_EQ( global_grid.globalNumEntity( Cajita::Cell(), 2 ), num_cell ); + EXPECT_EQ( global_grid.globalNumEntity( Cabana::Grid::Cell(), 0 ), + num_cell ); + EXPECT_EQ( global_grid.globalNumEntity( Cabana::Grid::Cell(), 1 ), + num_cell ); + EXPECT_EQ( global_grid.globalNumEntity( Cabana::Grid::Cell(), 2 ), + num_cell ); EXPECT_TRUE( global_grid.isPeriodic( 0 ) ); EXPECT_FALSE( global_grid.isPeriodic( 1 ) ); @@ -81,8 +85,8 @@ void mappingTest3d() // Give a bad guess that is still in the local domain to test the ability // to search. - auto global_cells = local_grid->indexSpace( Cajita::Own(), Cajita::Cell(), - Cajita::Global() ); + auto global_cells = local_grid->indexSpace( + Cabana::Grid::Own(), Cabana::Grid::Cell(), Cabana::Grid::Global() ); Kokkos::Array guess = { static_cast( global_cells.min( Dim::I ) ), static_cast( global_cells.min( Dim::J ) ), @@ -90,8 +94,9 @@ void mappingTest3d() // Check mapping. auto ghosted_cells = local_grid->indexSpace( - Cajita::Ghost(), Cajita::Cell(), Cajita::Local() ); - auto local_mesh = Cajita::createLocalMesh( *local_grid ); + Cabana::Grid::Ghost(), Cabana::Grid::Cell(), Cabana::Grid::Local() ); + auto local_mesh = + Cabana::Grid::createLocalMesh( *local_grid ); Kokkos::View cell_forward_map( "cell_forward_map", ghosted_cells.extent( Dim::I ), ghosted_cells.extent( Dim::J ), ghosted_cells.extent( Dim::K ) ); @@ -107,13 +112,14 @@ void mappingTest3d() Kokkos::View default_cell_map_success( "default_cell_reverse_map_success", ghosted_cells.extent( Dim::I ), ghosted_cells.extent( Dim::J ), ghosted_cells.extent( Dim::K ) ); - Cajita::grid_parallel_for( + Cabana::Grid::grid_parallel_for( "check_mapping", TEST_EXECSPACE{}, ghosted_cells, KOKKOS_LAMBDA( const int i, const int j, const int k ) { // Map to physical frame. LinearAlgebra::Vector cell_coords = 0.0; int ijk[3] = { i, j, k }; - local_mesh.coordinates( Cajita::Cell{}, ijk, cell_coords.data() ); + local_mesh.coordinates( Cabana::Grid::Cell{}, ijk, + cell_coords.data() ); LinearAlgebra::VectorView phys_coords( &cell_forward_map( i, j, k, 0 ), cell_forward_map.stride( 3 ) ); @@ -236,8 +242,10 @@ void mappingTest2d() EXPECT_EQ( global_mesh.highCorner( 0 ), num_cell ); EXPECT_EQ( global_mesh.highCorner( 1 ), num_cell ); - EXPECT_EQ( global_grid.globalNumEntity( Cajita::Cell(), 0 ), num_cell ); - EXPECT_EQ( global_grid.globalNumEntity( Cajita::Cell(), 1 ), num_cell ); + EXPECT_EQ( global_grid.globalNumEntity( Cabana::Grid::Cell(), 0 ), + num_cell ); + EXPECT_EQ( global_grid.globalNumEntity( Cabana::Grid::Cell(), 1 ), + num_cell ); EXPECT_TRUE( global_grid.isPeriodic( 0 ) ); EXPECT_FALSE( global_grid.isPeriodic( 1 ) ); @@ -247,16 +255,17 @@ void mappingTest2d() // Give a bad guess that is still in the local domain to test the ability // to search. - auto global_cells = local_grid->indexSpace( Cajita::Own(), Cajita::Cell(), - Cajita::Global() ); + auto global_cells = local_grid->indexSpace( + Cabana::Grid::Own(), Cabana::Grid::Cell(), Cabana::Grid::Global() ); Kokkos::Array guess = { static_cast( global_cells.min( Dim::I ) ), static_cast( global_cells.min( Dim::J ) ) }; // Check mapping. auto ghosted_cells = local_grid->indexSpace( - Cajita::Ghost(), Cajita::Cell(), Cajita::Local() ); - auto local_mesh = Cajita::createLocalMesh( *local_grid ); + Cabana::Grid::Ghost(), Cabana::Grid::Cell(), Cabana::Grid::Local() ); + auto local_mesh = + Cabana::Grid::createLocalMesh( *local_grid ); Kokkos::View cell_forward_map( "cell_forward_map", ghosted_cells.extent( Dim::I ), ghosted_cells.extent( Dim::J ) ); @@ -272,13 +281,14 @@ void mappingTest2d() Kokkos::View default_cell_map_success( "default_cell_reverse_map_success", ghosted_cells.extent( Dim::I ), ghosted_cells.extent( Dim::J ) ); - Cajita::grid_parallel_for( + Cabana::Grid::grid_parallel_for( "check_mapping", TEST_EXECSPACE{}, ghosted_cells, KOKKOS_LAMBDA( const int i, const int j ) { // Map to physical frame. LinearAlgebra::Vector cell_coords = 0.0; int ijk[2] = { i, j }; - local_mesh.coordinates( Cajita::Cell{}, ijk, cell_coords.data() ); + local_mesh.coordinates( Cabana::Grid::Cell{}, ijk, + cell_coords.data() ); LinearAlgebra::VectorView phys_coords( &cell_forward_map( i, j, 0 ), cell_forward_map.stride( 2 ) ); CurvilinearMeshMapping::mapToPhysicalFrame( diff --git a/unit_test/tstFacetGeometry.hpp b/unit_test/tstFacetGeometry.hpp index 40a6735..0505a4c 100644 --- a/unit_test/tstFacetGeometry.hpp +++ b/unit_test/tstFacetGeometry.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include @@ -516,18 +516,19 @@ void initExample() Cabana::ParticleTraits, Field::VolumeId> fields; auto particles = - Cajita::createParticleList( "particles", fields ); + Cabana::Grid::createParticleList( "particles", fields ); FacetGeometry geometry( parser.propertyTree(), TEST_EXECSPACE() ); LocateFunctor init_func; init_func.geom = geometry.data(); - Cajita::createParticles( Cabana::InitUniform(), TEST_EXECSPACE(), init_func, - particles, 1, *( mesh->localGrid() ) ); + Cabana::Grid::createParticles( Cabana::InitUniform(), TEST_EXECSPACE(), + init_func, particles, 1, + *( mesh->localGrid() ) ); #ifdef Cabana_ENABLE_SILO - Cajita::Experimental::SiloParticleOutput::writeTimeStep( + Cabana::Grid::Experimental::SiloParticleOutput::writeTimeStep( "particles", mesh->localGrid()->globalGrid(), 0, 0.0, particles.slice( Field::PhysicalPosition<3>() ), particles.slice( Field::VolumeId() ) ); diff --git a/unit_test/tstFieldManager.hpp b/unit_test/tstFieldManager.hpp index 89bb28a..8b6e858 100644 --- a/unit_test/tstFieldManager.hpp +++ b/unit_test/tstFieldManager.hpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include @@ -65,28 +65,30 @@ void uniformTest() fm.add( FieldLocation::Edge(), Field::Color() ); // Put data in the fields. - Cajita::ArrayOp::assign( *fm.array( FieldLocation::Node(), Field::Color() ), - 1, Cajita::Own() ); - Cajita::ArrayOp::assign( *fm.array( FieldLocation::Cell(), Field::Color() ), - 2, Cajita::Own() ); - Cajita::ArrayOp::assign( + Cabana::Grid::ArrayOp::assign( + *fm.array( FieldLocation::Node(), Field::Color() ), 1, + Cabana::Grid::Own() ); + Cabana::Grid::ArrayOp::assign( + *fm.array( FieldLocation::Cell(), Field::Color() ), 2, + Cabana::Grid::Own() ); + Cabana::Grid::ArrayOp::assign( *fm.array( FieldLocation::Face(), Field::Color() ), 3, - Cajita::Own() ); - Cajita::ArrayOp::assign( + Cabana::Grid::Own() ); + Cabana::Grid::ArrayOp::assign( *fm.array( FieldLocation::Face(), Field::Color() ), 4, - Cajita::Own() ); - Cajita::ArrayOp::assign( + Cabana::Grid::Own() ); + Cabana::Grid::ArrayOp::assign( *fm.array( FieldLocation::Face(), Field::Color() ), 5, - Cajita::Own() ); - Cajita::ArrayOp::assign( + Cabana::Grid::Own() ); + Cabana::Grid::ArrayOp::assign( *fm.array( FieldLocation::Edge(), Field::Color() ), 6, - Cajita::Own() ); - Cajita::ArrayOp::assign( + Cabana::Grid::Own() ); + Cabana::Grid::ArrayOp::assign( *fm.array( FieldLocation::Edge(), Field::Color() ), 7, - Cajita::Own() ); - Cajita::ArrayOp::assign( + Cabana::Grid::Own() ); + Cabana::Grid::ArrayOp::assign( *fm.array( FieldLocation::Edge(), Field::Color() ), 8, - Cajita::Own() ); + Cabana::Grid::Own() ); // Gather into the ghost zones. fm.gather( FieldLocation::Node(), Field::Color() ); @@ -100,36 +102,44 @@ void uniformTest() // Check the gather. checkGather( fm.view( FieldLocation::Node(), Field::Color() ), - mesh->localGrid()->indexSpace( Cajita::Ghost(), Cajita::Node(), - Cajita::Local() ), + mesh->localGrid()->indexSpace( Cabana::Grid::Ghost(), + Cabana::Grid::Node(), + Cabana::Grid::Local() ), 1 ); checkGather( fm.view( FieldLocation::Cell(), Field::Color() ), - mesh->localGrid()->indexSpace( Cajita::Ghost(), Cajita::Cell(), - Cajita::Local() ), + mesh->localGrid()->indexSpace( Cabana::Grid::Ghost(), + Cabana::Grid::Cell(), + Cabana::Grid::Local() ), 2 ); checkGather( fm.view( FieldLocation::Face(), Field::Color() ), - mesh->localGrid()->indexSpace( - Cajita::Ghost(), Cajita::Face(), Cajita::Local() ), + mesh->localGrid()->indexSpace( Cabana::Grid::Ghost(), + Cabana::Grid::Face(), + Cabana::Grid::Local() ), 3 ); checkGather( fm.view( FieldLocation::Face(), Field::Color() ), - mesh->localGrid()->indexSpace( - Cajita::Ghost(), Cajita::Face(), Cajita::Local() ), + mesh->localGrid()->indexSpace( Cabana::Grid::Ghost(), + Cabana::Grid::Face(), + Cabana::Grid::Local() ), 4 ); checkGather( fm.view( FieldLocation::Face(), Field::Color() ), - mesh->localGrid()->indexSpace( - Cajita::Ghost(), Cajita::Face(), Cajita::Local() ), + mesh->localGrid()->indexSpace( Cabana::Grid::Ghost(), + Cabana::Grid::Face(), + Cabana::Grid::Local() ), 5 ); checkGather( fm.view( FieldLocation::Edge(), Field::Color() ), - mesh->localGrid()->indexSpace( - Cajita::Ghost(), Cajita::Edge(), Cajita::Local() ), + mesh->localGrid()->indexSpace( Cabana::Grid::Ghost(), + Cabana::Grid::Edge(), + Cabana::Grid::Local() ), 6 ); checkGather( fm.view( FieldLocation::Edge(), Field::Color() ), - mesh->localGrid()->indexSpace( - Cajita::Ghost(), Cajita::Edge(), Cajita::Local() ), + mesh->localGrid()->indexSpace( Cabana::Grid::Ghost(), + Cabana::Grid::Edge(), + Cabana::Grid::Local() ), 7 ); checkGather( fm.view( FieldLocation::Edge(), Field::Color() ), - mesh->localGrid()->indexSpace( - Cajita::Ghost(), Cajita::Edge(), Cajita::Local() ), + mesh->localGrid()->indexSpace( Cabana::Grid::Ghost(), + Cabana::Grid::Edge(), + Cabana::Grid::Local() ), 8 ); // Scatter back to owned. @@ -166,22 +176,22 @@ void adaptiveTest() fm.array( FieldLocation::Node(), Field::PhysicalPosition<3>() ); auto host_coords = Kokkos::create_mirror_view_and_copy( Kokkos::HostSpace(), nodes->view() ); - auto local_mesh = Cajita::createLocalMesh( + auto local_mesh = Cabana::Grid::createLocalMesh( *( nodes->layout()->localGrid() ) ); auto local_space = nodes->layout()->localGrid()->indexSpace( - Cajita::Ghost(), Cajita::Node(), Cajita::Local() ); + Cabana::Grid::Ghost(), Cabana::Grid::Node(), Cabana::Grid::Local() ); for ( int i = local_space.min( 0 ); i < local_space.max( 0 ); ++i ) for ( int j = local_space.min( 1 ); j < local_space.max( 1 ); ++j ) for ( int k = local_space.min( 2 ); k < local_space.max( 2 ); ++k ) { EXPECT_EQ( host_coords( i, j, k, 0 ), - local_mesh.lowCorner( Cajita::Ghost(), 0 ) + + local_mesh.lowCorner( Cabana::Grid::Ghost(), 0 ) + i * cell_size ); EXPECT_EQ( host_coords( i, j, k, 1 ), - local_mesh.lowCorner( Cajita::Ghost(), 1 ) + + local_mesh.lowCorner( Cabana::Grid::Ghost(), 1 ) + j * cell_size ); EXPECT_EQ( host_coords( i, j, k, 2 ), - local_mesh.lowCorner( Cajita::Ghost(), 2 ) + + local_mesh.lowCorner( Cabana::Grid::Ghost(), 2 ) + k * cell_size ); } } diff --git a/unit_test/tstGridOperator2d.hpp b/unit_test/tstGridOperator2d.hpp index 07f0a16..8d31210 100644 --- a/unit_test/tstGridOperator2d.hpp +++ b/unit_test/tstGridOperator2d.hpp @@ -19,9 +19,8 @@ #include #include -#include - #include +#include #include @@ -178,9 +177,9 @@ void gatherScatterTest() fm->view( FieldLocation::Cell(), FooOut() ) ); Kokkos::deep_copy( bar_out_host, fm->view( FieldLocation::Cell(), BarOut() ) ); - Cajita::grid_parallel_for( + Cabana::Grid::grid_parallel_for( "check_grid_out", Kokkos::DefaultHostExecutionSpace(), - *( fm->mesh()->localGrid() ), Cajita::Own(), Cajita::Cell(), + *( fm->mesh()->localGrid() ), Cabana::Grid::Own(), Cabana::Grid::Cell(), KOKKOS_LAMBDA( const int i, const int j ) { for ( int d = 0; d < 2; ++d ) EXPECT_EQ( foo_out_host( i, j, d ), 4.0 + i + j ); diff --git a/unit_test/tstGridOperator3d.hpp b/unit_test/tstGridOperator3d.hpp index af14d51..2f4cd2c 100644 --- a/unit_test/tstGridOperator3d.hpp +++ b/unit_test/tstGridOperator3d.hpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include @@ -343,8 +343,8 @@ void gatherScatterTest() // Make a particle list. Cabana::ParticleTraits, FooP, BarP> fields; - auto particles = - Cajita::createParticleList( "test_particles", fields ); + auto particles = Cabana::Grid::createParticleList( + "test_particles", fields ); using list_type = decltype( particles ); using particle_type = typename list_type::particle_type; @@ -360,9 +360,9 @@ void gatherScatterTest() // Initialize particles. int ppc = 10; - Cajita::createParticles( Cabana::InitRandom(), TEST_EXECSPACE(), - particle_init_func, particles, ppc, - *( mesh->localGrid() ) ); + Cabana::Grid::createParticles( Cabana::InitRandom(), TEST_EXECSPACE(), + particle_init_func, particles, ppc, + *( mesh->localGrid() ) ); // Make an operator. using gather_deps = @@ -420,9 +420,9 @@ void gatherScatterTest() Kokkos::HostSpace(), fm->view( FieldLocation::Cell(), FooOut() ) ); auto bar_out_host = Kokkos::create_mirror_view_and_copy( Kokkos::HostSpace(), fm->view( FieldLocation::Cell(), BarOut() ) ); - Cajita::grid_parallel_for( + Cabana::Grid::grid_parallel_for( "check_grid_out", Kokkos::DefaultHostExecutionSpace(), - *( mesh->localGrid() ), Cajita::Own(), Cajita::Cell(), + *( mesh->localGrid() ), Cabana::Grid::Own(), Cabana::Grid::Cell(), KOKKOS_LAMBDA( const int i, const int j, const int k ) { for ( int d = 0; d < 3; ++d ) EXPECT_EQ( foo_out_host( i, j, k, d ), ppc * 2.0 ); @@ -439,9 +439,9 @@ void gatherScatterTest() fm->view( FieldLocation::Cell(), FooOut() ) ); Kokkos::deep_copy( bar_out_host, fm->view( FieldLocation::Cell(), BarOut() ) ); - Cajita::grid_parallel_for( + Cabana::Grid::grid_parallel_for( "check_grid_out", Kokkos::DefaultHostExecutionSpace(), - *( mesh->localGrid() ), Cajita::Own(), Cajita::Cell(), + *( mesh->localGrid() ), Cabana::Grid::Own(), Cabana::Grid::Cell(), KOKKOS_LAMBDA( const int i, const int j, const int k ) { for ( int d = 0; d < 3; ++d ) EXPECT_EQ( foo_out_host( i, j, k, d ), 4.0 + i + j + k ); @@ -472,9 +472,9 @@ void gatherScatterTest() Kokkos::HostSpace(), fm->view( FieldLocation::Cell(), MatK() ) ); // Expect the correct cross-product for the given vector fields - Cajita::grid_parallel_for( + Cabana::Grid::grid_parallel_for( "check_tensor3_cross_product", Kokkos::DefaultHostExecutionSpace(), - *( mesh->localGrid() ), Cajita::Own(), Cajita::Cell(), + *( mesh->localGrid() ), Cabana::Grid::Own(), Cabana::Grid::Cell(), KOKKOS_LAMBDA( const int i, const int j, const int k ) { EXPECT_EQ( foo_out_host( i, j, k, 0 ), -6.0 ); EXPECT_EQ( foo_out_host( i, j, k, 1 ), 6.0 ); @@ -482,9 +482,9 @@ void gatherScatterTest() } ); // Expect the correct matrices from the various Tensor3 contractions - Cajita::grid_parallel_for( + Cabana::Grid::grid_parallel_for( "check_tensor3_vector_contract", Kokkos::DefaultHostExecutionSpace(), - *( mesh->localGrid() ), Cajita::Own(), Cajita::Cell(), + *( mesh->localGrid() ), Cabana::Grid::Own(), Cabana::Grid::Cell(), KOKKOS_LAMBDA( const int i, const int j, const int k ) { EXPECT_EQ( mi_out_host( i, j, k, 0 ), 72 ); EXPECT_EQ( mi_out_host( i, j, k, 1 ), 78 ); @@ -525,9 +525,9 @@ void gatherScatterTest() Kokkos::HostSpace(), fm->view( FieldLocation::Cell(), Baz() ) ); // Expect the correct matrices from the various tensor contractions - Cajita::grid_parallel_for( + Cabana::Grid::grid_parallel_for( "check_tensor4_matrix_contract", Kokkos::DefaultHostExecutionSpace(), - *( mesh->localGrid() ), Cajita::Own(), Cajita::Cell(), + *( mesh->localGrid() ), Cabana::Grid::Own(), Cabana::Grid::Cell(), KOKKOS_LAMBDA( const int i, const int j, const int k ) { EXPECT_EQ( baz_out_host( i, j, k, 0 ), 1.25 ); EXPECT_EQ( baz_out_host( i, j, k, 1 ), 2 ); diff --git a/unit_test/tstLevelSetRedistance.hpp b/unit_test/tstLevelSetRedistance.hpp index b48fb1b..649629a 100644 --- a/unit_test/tstLevelSetRedistance.hpp +++ b/unit_test/tstLevelSetRedistance.hpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include @@ -63,21 +63,21 @@ void runTest( const Phi0& phi_0, const PhiR& phi_r, const double test_eps ) // Local mesh. auto local_mesh = - Cajita::createLocalMesh( *( mesh->localGrid() ) ); + Cabana::Grid::createLocalMesh( *( mesh->localGrid() ) ); // Populate the initial estimate. auto own_entities = mesh->localGrid()->indexSpace( - Cajita::Own(), Cajita::Node(), Cajita::Local() ); + Cabana::Grid::Own(), Cabana::Grid::Node(), Cabana::Grid::Local() ); Kokkos::parallel_for( "estimate", - Cajita::createExecutionPolicy( own_entities, TEST_EXECSPACE() ), + Cabana::Grid::createExecutionPolicy( own_entities, TEST_EXECSPACE() ), KOKKOS_LAMBDA( const int i, const int j, const int k ) { // Get the entity index. int entity_index[3] = { i, j, k }; // Get the entity location. double x[3]; - local_mesh.coordinates( Cajita::Node(), entity_index, x ); + local_mesh.coordinates( Cabana::Grid::Node(), entity_index, x ); // Assign the estimate value. estimate_view( i, j, k, 0 ) = phi_0( x[0], x[1], x[2] ); @@ -95,12 +95,12 @@ void runTest( const Phi0& phi_0, const PhiR& phi_r, const double test_eps ) // is less than the halo. auto host_distance = Kokkos::create_mirror_view_and_copy( Kokkos::HostSpace(), distance_view ); - auto host_mesh = - Cajita::createLocalMesh( *( mesh->localGrid() ) ); + auto host_mesh = Cabana::Grid::createLocalMesh( + *( mesh->localGrid() ) ); Kokkos::parallel_for( "test", - Cajita::createExecutionPolicy( own_entities, - Kokkos::DefaultHostExecutionSpace() ), + Cabana::Grid::createExecutionPolicy( + own_entities, Kokkos::DefaultHostExecutionSpace() ), [=]( const int i, const int j, const int k ) { // Get the entity index. @@ -108,7 +108,7 @@ void runTest( const Phi0& phi_0, const PhiR& phi_r, const double test_eps ) // Get the entity location. double x[3]; - host_mesh.coordinates( Cajita::Node(), entity_index, x ); + host_mesh.coordinates( Cabana::Grid::Node(), entity_index, x ); // Observed result. auto observed = host_distance( i, j, k, 0 ); diff --git a/unit_test/tstMarchingCubes.hpp b/unit_test/tstMarchingCubes.hpp index 96b7f7c..f929513 100644 --- a/unit_test/tstMarchingCubes.hpp +++ b/unit_test/tstMarchingCubes.hpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include @@ -63,21 +63,21 @@ void runTest( const Phi0& phi_0, const std::string& stl_filename ) // Local mesh. auto local_mesh = - Cajita::createLocalMesh( *( mesh->localGrid() ) ); + Cabana::Grid::createLocalMesh( *( mesh->localGrid() ) ); // Populate the initial estimate. auto own_entities = mesh->localGrid()->indexSpace( - Cajita::Own(), Cajita::Node(), Cajita::Local() ); + Cabana::Grid::Own(), Cabana::Grid::Node(), Cabana::Grid::Local() ); Kokkos::parallel_for( "estimate", - Cajita::createExecutionPolicy( own_entities, TEST_EXECSPACE{} ), + Cabana::Grid::createExecutionPolicy( own_entities, TEST_EXECSPACE{} ), KOKKOS_LAMBDA( const int i, const int j, const int k ) { // Get the entity index. int entity_index[3] = { i, j, k }; // Get the entity location. double x[3]; - local_mesh.coordinates( Cajita::Node(), entity_index, x ); + local_mesh.coordinates( Cabana::Grid::Node(), entity_index, x ); // Assign the estimate value. estimate_view( i, j, k, 0 ) = phi_0( x[0], x[1], x[2] ); @@ -94,7 +94,7 @@ void runTest( const Phi0& phi_0, const std::string& stl_filename ) MarchingCubes::writeDataToSTL( *mc_data, MPI_COMM_WORLD, stl_filename ); // Output a bov file with the level set. - Cajita::Experimental::BovWriter::writeTimeStep( 0, 0.0, *distance ); + Cabana::Grid::Experimental::BovWriter::writeTimeStep( 0, 0.0, *distance ); double area = 16.0 * std::atan( 1.0 ) * 0.25 * 0.25; double facet_area = 0.0; diff --git a/unit_test/tstParticleInterpolation.hpp b/unit_test/tstParticleInterpolation.hpp index 5556c59..e4449d8 100644 --- a/unit_test/tstParticleInterpolation.hpp +++ b/unit_test/tstParticleInterpolation.hpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include @@ -374,14 +374,14 @@ void interpolationTest() // Get a set of locall-owned node indices for testing. auto node_space = mesh->localGrid()->indexSpace( - Cajita::Own(), Cajita::Node(), Cajita::Local() ); + Cabana::Grid::Own(), Cabana::Grid::Node(), Cabana::Grid::Local() ); // Make a particle list. Cabana::ParticleTraits, ParticleScalar, ParticleVector, ParticleTensor> fields; - auto particles = - Cajita::createParticleList( "test_particles", fields ); + auto particles = Cabana::Grid::createParticleList( + "test_particles", fields ); using list_type = decltype( particles ); using particle_type = typename list_type::particle_type; @@ -396,9 +396,9 @@ void interpolationTest() // Initialize particles. Put one particle in the center of every cell. int ppc = 1; - Cajita::createParticles( Cabana::InitUniform(), TEST_EXECSPACE(), - particle_init_func, particles, ppc, - *( mesh->localGrid() ) ); + Cabana::Grid::createParticles( Cabana::InitUniform(), TEST_EXECSPACE(), + particle_init_func, particles, ppc, + *( mesh->localGrid() ) ); int num_particle = particles.size(); // Get slices. diff --git a/unit_test/tstParticleLevelSet.hpp b/unit_test/tstParticleLevelSet.hpp index 60f2ec9..351a5d8 100644 --- a/unit_test/tstParticleLevelSet.hpp +++ b/unit_test/tstParticleLevelSet.hpp @@ -19,7 +19,7 @@ #include -#include +#include #include @@ -73,7 +73,7 @@ void zalesaksTest( const std::string& filename ) MPI_COMM_WORLD ); // Create particles. - auto particles = Cajita::createParticleList( + auto particles = Cabana::Grid::createParticleList( "particles", Cabana::ParticleTraits, Field::LogicalPosition<3>, Field::Color, Field::CommRank>() ); @@ -83,13 +83,14 @@ void zalesaksTest( const std::string& filename ) int ppc = 3; LocateFunctor init_func; init_func.geom = geometry.data(); - Cajita::createParticles( Cabana::InitUniform(), TEST_EXECSPACE(), init_func, - particles, ppc, *( mesh->localGrid() ) ); + Cabana::Grid::createParticles( Cabana::InitUniform(), TEST_EXECSPACE(), + init_func, particles, ppc, + *( mesh->localGrid() ) ); // Write the initial particle state. double time = 0.0; #ifdef Cabana_ENABLE_SILO - Cajita::Experimental::SiloParticleOutput::writeTimeStep( + Cabana::Grid::Experimental::SiloParticleOutput::writeTimeStep( "particles", mesh->localGrid()->globalGrid(), 0, time, particles.slice( Field::PhysicalPosition<3>() ), particles.slice( Field::Color() ), @@ -109,9 +110,9 @@ void zalesaksTest( const std::string& filename ) level_set->levelSet()->redistance( TEST_EXECSPACE() ); // Write the initial level set. - Cajita::Experimental::BovWriter::writeTimeStep( + Cabana::Grid::Experimental::BovWriter::writeTimeStep( 0, time, *( level_set->levelSet()->getDistanceEstimate() ) ); - Cajita::Experimental::BovWriter::writeTimeStep( + Cabana::Grid::Experimental::BovWriter::writeTimeStep( 0, time, *( level_set->levelSet()->getSignedDistance() ) ); // Advect the disk one full rotation. @@ -171,7 +172,7 @@ void zalesaksTest( const std::string& filename ) // Write the particle state. time += 1.0; #ifdef Cabana_ENABLE_SILO - Cajita::Experimental::SiloParticleOutput::writeTimeStep( + Cabana::Grid::Experimental::SiloParticleOutput::writeTimeStep( "particles", mesh->localGrid()->globalGrid(), t + 1, time, particles.slice( Field::PhysicalPosition<3>() ), particles.slice( Field::Color() ), @@ -184,9 +185,9 @@ void zalesaksTest( const std::string& filename ) level_set->levelSet()->redistance( TEST_EXECSPACE() ); // Write the level set. - Cajita::Experimental::BovWriter::writeTimeStep( + Cabana::Grid::Experimental::BovWriter::writeTimeStep( t + 1, time, *( level_set->levelSet()->getDistanceEstimate() ) ); - Cajita::Experimental::BovWriter::writeTimeStep( + Cabana::Grid::Experimental::BovWriter::writeTimeStep( t + 1, time, *( level_set->levelSet()->getSignedDistance() ) ); } } diff --git a/unit_test/tstParticleList.hpp b/unit_test/tstParticleList.hpp index c858b23..1d543d5 100644 --- a/unit_test/tstParticleList.hpp +++ b/unit_test/tstParticleList.hpp @@ -14,8 +14,6 @@ #include #include -#include -#include #include @@ -43,8 +41,8 @@ void linearAlgebraTest() // Make a particle list. Cabana::ParticleTraits, Foo, Field::Color, Bar> fields; - auto particles = - Cajita::createParticleList( "test_particles", fields ); + auto particles = Cabana::Grid::createParticleList( + "test_particles", fields ); // Resize the aosoa. auto& aosoa = particles.aosoa(); diff --git a/unit_test/tstPolyPIC.hpp b/unit_test/tstPolyPIC.hpp index d6c53d3..df44d57 100644 --- a/unit_test/tstPolyPIC.hpp +++ b/unit_test/tstPolyPIC.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include @@ -208,7 +208,7 @@ void collocatedTest() UniformMesh mesh( ptree, global_box, minimum_halo_size, MPI_COMM_WORLD ); auto local_mesh = - Cajita::createLocalMesh( *( mesh.localGrid() ) ); + Cabana::Grid::createLocalMesh( *( mesh.localGrid() ) ); // Time step size. double dt = 0.0001; @@ -237,9 +237,10 @@ void collocatedTest() // Initialize the grid vector. auto gv_view = grid_vector->view(); - Cajita::grid_parallel_for( + Cabana::Grid::grid_parallel_for( "fill_grid_vector", TEST_EXECSPACE(), - grid_vector->layout()->indexSpace( Cajita::Own(), Cajita::Local() ), + grid_vector->layout()->indexSpace( Cabana::Grid::Own(), + Cabana::Grid::Local() ), KOKKOS_LAMBDA( const int i, const int j, const int k, const int d ) { int ic = i - 2; int jc = j - 2; @@ -350,7 +351,7 @@ void staggeredTest() // If we are using faces offset the non-test dimensions to align with the // mathematica grid. - if ( Cajita::isFace::value ) + if ( Cabana::Grid::isFace::value ) for ( int d = 0; d < 3; ++d ) { if ( d != Dim ) @@ -362,7 +363,7 @@ void staggeredTest() // If we are using edges offset that dimension to align with the // mathematica grid for the quadratic functions. - else if ( Cajita::isEdge::value ) + else if ( Cabana::Grid::isEdge::value ) { global_box[Dim] -= 0.25; global_box[Dim + 3] -= 0.25; @@ -377,7 +378,7 @@ void staggeredTest() UniformMesh mesh( ptree, global_box, minimum_halo_size, MPI_COMM_WORLD ); auto local_mesh = - Cajita::createLocalMesh( *( mesh.localGrid() ) ); + Cabana::Grid::createLocalMesh( *( mesh.localGrid() ) ); // Time step size. double dt = 0.0001; @@ -406,9 +407,10 @@ void staggeredTest() // Initialize the grid scalar. auto gs_view = grid_scalar->view(); - Cajita::grid_parallel_for( + Cabana::Grid::grid_parallel_for( "fill_grid_scalar", TEST_EXECSPACE(), - grid_scalar->layout()->indexSpace( Cajita::Own(), Cajita::Local() ), + grid_scalar->layout()->indexSpace( Cabana::Grid::Own(), + Cabana::Grid::Local() ), KOKKOS_LAMBDA( const int i, const int j, const int k, const int ) { int ic = i - 2; int jc = j - 2; diff --git a/unit_test/tstUniformCartesianMeshMapping.hpp b/unit_test/tstUniformCartesianMeshMapping.hpp index e2d5ac7..55de3a9 100644 --- a/unit_test/tstUniformCartesianMeshMapping.hpp +++ b/unit_test/tstUniformCartesianMeshMapping.hpp @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -70,9 +71,12 @@ void mappingTest3d() EXPECT_EQ( global_mesh.highCorner( 1 ), num_cell ); EXPECT_EQ( global_mesh.highCorner( 2 ), num_cell ); - EXPECT_EQ( global_grid.globalNumEntity( Cajita::Cell(), 0 ), num_cell ); - EXPECT_EQ( global_grid.globalNumEntity( Cajita::Cell(), 1 ), num_cell ); - EXPECT_EQ( global_grid.globalNumEntity( Cajita::Cell(), 2 ), num_cell ); + EXPECT_EQ( global_grid.globalNumEntity( Cabana::Grid::Cell(), 0 ), + num_cell ); + EXPECT_EQ( global_grid.globalNumEntity( Cabana::Grid::Cell(), 1 ), + num_cell ); + EXPECT_EQ( global_grid.globalNumEntity( Cabana::Grid::Cell(), 2 ), + num_cell ); EXPECT_TRUE( global_grid.isPeriodic( 0 ) ); EXPECT_FALSE( global_grid.isPeriodic( 1 ) ); @@ -83,8 +87,9 @@ void mappingTest3d() // Check mapping. auto ghosted_cells = local_grid->indexSpace( - Cajita::Ghost(), Cajita::Cell(), Cajita::Local() ); - auto local_mesh = Cajita::createLocalMesh( *local_grid ); + Cabana::Grid::Ghost(), Cabana::Grid::Cell(), Cabana::Grid::Local() ); + auto local_mesh = + Cabana::Grid::createLocalMesh( *local_grid ); Kokkos::View cell_forward_map( "cell_forward_map", ghosted_cells.extent( Dim::I ), ghosted_cells.extent( Dim::J ), ghosted_cells.extent( Dim::K ) ); @@ -100,13 +105,14 @@ void mappingTest3d() Kokkos::View default_cell_map_success( "default_cell_reverse_map_success", ghosted_cells.extent( Dim::I ), ghosted_cells.extent( Dim::J ), ghosted_cells.extent( Dim::K ) ); - Cajita::grid_parallel_for( + Cabana::Grid::grid_parallel_for( "check_mapping", TEST_EXECSPACE{}, ghosted_cells, KOKKOS_LAMBDA( const int i, const int j, const int k ) { // Map to physical frame. LinearAlgebra::Vector cell_coords = 0.0; int ijk[3] = { i, j, k }; - local_mesh.coordinates( Cajita::Cell{}, ijk, cell_coords.data() ); + local_mesh.coordinates( Cabana::Grid::Cell{}, ijk, + cell_coords.data() ); LinearAlgebra::VectorView phys_coords( &cell_forward_map( i, j, k, 0 ), cell_forward_map.stride( 3 ) ); CurvilinearMeshMapping::mapToPhysicalFrame( @@ -231,8 +237,10 @@ void mappingTest2d() EXPECT_EQ( global_mesh.highCorner( 0 ), num_cell ); EXPECT_EQ( global_mesh.highCorner( 1 ), num_cell ); - EXPECT_EQ( global_grid.globalNumEntity( Cajita::Cell(), 0 ), num_cell ); - EXPECT_EQ( global_grid.globalNumEntity( Cajita::Cell(), 1 ), num_cell ); + EXPECT_EQ( global_grid.globalNumEntity( Cabana::Grid::Cell(), 0 ), + num_cell ); + EXPECT_EQ( global_grid.globalNumEntity( Cabana::Grid::Cell(), 1 ), + num_cell ); EXPECT_TRUE( global_grid.isPeriodic( 0 ) ); EXPECT_FALSE( global_grid.isPeriodic( 1 ) ); @@ -242,8 +250,9 @@ void mappingTest2d() // Check mapping. auto ghosted_cells = local_grid->indexSpace( - Cajita::Ghost(), Cajita::Cell(), Cajita::Local() ); - auto local_mesh = Cajita::createLocalMesh( *local_grid ); + Cabana::Grid::Ghost(), Cabana::Grid::Cell(), Cabana::Grid::Local() ); + auto local_mesh = + Cabana::Grid::createLocalMesh( *local_grid ); Kokkos::View cell_forward_map( "cell_forward_map", ghosted_cells.extent( Dim::I ), ghosted_cells.extent( Dim::J ) ); @@ -259,13 +268,14 @@ void mappingTest2d() Kokkos::View default_cell_map_success( "default_cell_reverse_map_success", ghosted_cells.extent( Dim::I ), ghosted_cells.extent( Dim::J ) ); - Cajita::grid_parallel_for( + Cabana::Grid::grid_parallel_for( "check_mapping", TEST_EXECSPACE{}, ghosted_cells, KOKKOS_LAMBDA( const int i, const int j ) { // Map to physical frame. LinearAlgebra::Vector cell_coords = 0.0; int ijk[2] = { i, j }; - local_mesh.coordinates( Cajita::Cell{}, ijk, cell_coords.data() ); + local_mesh.coordinates( Cabana::Grid::Cell{}, ijk, + cell_coords.data() ); LinearAlgebra::VectorView phys_coords( &cell_forward_map( i, j, 0 ), cell_forward_map.stride( 2 ) ); CurvilinearMeshMapping::mapToPhysicalFrame( diff --git a/unit_test/tstUniformMesh.hpp b/unit_test/tstUniformMesh.hpp index 3c56e00..f66f754 100644 --- a/unit_test/tstUniformMesh.hpp +++ b/unit_test/tstUniformMesh.hpp @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -56,10 +57,12 @@ void constructionTest() EXPECT_EQ( global_mesh_1.highCorner( 1 ), global_box[4] + cell_size ); EXPECT_EQ( global_mesh_1.highCorner( 2 ), global_box[5] ); - EXPECT_EQ( global_grid_1.globalNumEntity( Cajita::Cell(), 0 ), num_cell ); - EXPECT_EQ( global_grid_1.globalNumEntity( Cajita::Cell(), 1 ), + EXPECT_EQ( global_grid_1.globalNumEntity( Cabana::Grid::Cell(), 0 ), + num_cell ); + EXPECT_EQ( global_grid_1.globalNumEntity( Cabana::Grid::Cell(), 1 ), num_cell + 2 ); - EXPECT_EQ( global_grid_1.globalNumEntity( Cajita::Cell(), 2 ), num_cell ); + EXPECT_EQ( global_grid_1.globalNumEntity( Cabana::Grid::Cell(), 2 ), + num_cell ); EXPECT_TRUE( global_grid_1.isPeriodic( 0 ) ); EXPECT_FALSE( global_grid_1.isPeriodic( 1 ) ); @@ -90,10 +93,11 @@ void constructionTest() EXPECT_EQ( global_mesh_2.highCorner( 1 ), global_box[4] ); EXPECT_EQ( global_mesh_2.highCorner( 2 ), global_box[5] + cell_size ); - EXPECT_EQ( global_grid_2.globalNumEntity( Cajita::Cell(), 0 ), + EXPECT_EQ( global_grid_2.globalNumEntity( Cabana::Grid::Cell(), 0 ), num_cell + 2 ); - EXPECT_EQ( global_grid_2.globalNumEntity( Cajita::Cell(), 1 ), num_cell ); - EXPECT_EQ( global_grid_2.globalNumEntity( Cajita::Cell(), 2 ), + EXPECT_EQ( global_grid_2.globalNumEntity( Cabana::Grid::Cell(), 1 ), + num_cell ); + EXPECT_EQ( global_grid_2.globalNumEntity( Cabana::Grid::Cell(), 2 ), num_cell + 2 ); EXPECT_FALSE( global_grid_2.isPeriodic( 0 ) ); @@ -107,8 +111,8 @@ void constructionTest() auto host_coords_2 = Kokkos::create_mirror_view_and_copy( Kokkos::HostSpace(), nodes_2->view() ); auto local_space_2 = nodes_2->layout()->localGrid()->indexSpace( - Cajita::Ghost(), Cajita::Node(), Cajita::Local() ); - auto local_mesh_2 = Cajita::createLocalMesh( + Cabana::Grid::Ghost(), Cabana::Grid::Node(), Cabana::Grid::Local() ); + auto local_mesh_2 = Cabana::Grid::createLocalMesh( *( nodes_2->layout()->localGrid() ) ); for ( int i = local_space_2.min( 0 ); i < local_space_2.max( 0 ); ++i ) for ( int j = local_space_2.min( 1 ); j < local_space_2.max( 1 ); ++j ) @@ -116,13 +120,13 @@ void constructionTest() ++k ) { EXPECT_EQ( host_coords_2( i, j, k, 0 ), - local_mesh_2.lowCorner( Cajita::Ghost(), 0 ) + + local_mesh_2.lowCorner( Cabana::Grid::Ghost(), 0 ) + i * cell_size ); EXPECT_EQ( host_coords_2( i, j, k, 1 ), - local_mesh_2.lowCorner( Cajita::Ghost(), 1 ) + + local_mesh_2.lowCorner( Cabana::Grid::Ghost(), 1 ) + j * cell_size ); EXPECT_EQ( host_coords_2( i, j, k, 2 ), - local_mesh_2.lowCorner( Cajita::Ghost(), 2 ) + + local_mesh_2.lowCorner( Cabana::Grid::Ghost(), 2 ) + k * cell_size ); } }