diff --git a/CMakeLists.txt b/CMakeLists.txt index 48e17e288..2e5e7df52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,13 +96,32 @@ project_options( ${ENABLE_CONAN} ) -add_library(samurai INTERFACE) -target_compile_features(samurai INTERFACE cxx_std_20) -target_link_libraries(samurai INTERFACE project_options project_warnings) +set(SAMURAI_SOURCES + src/samurai/mesh_interval.cpp + src/samurai/level_cell_list.cpp + src/samurai/box.cpp + src/samurai/reconstruction.cpp + src/samurai/interval.cpp + src/samurai/cell.cpp + src/samurai/cell_list.cpp + src/samurai/stencil_field.cpp + src/samurai/cell_array.cpp + src/samurai/level_cell_array.cpp + src/samurai/list_of_intervals.cpp + src/samurai/domain_builder.cpp + src/samurai/mr/mesh.cpp + src/samurai/mr/adapt.cpp + src/samurai/array_of_interval_and_point.cpp + src/samurai/field/scalar_field.cpp + src/samurai/field/vector_field.cpp) + +add_library(samurai ${SAMURAI_SOURCES}) +target_compile_features(samurai PUBLIC cxx_std_20) +target_link_libraries(samurai PUBLIC project_options project_warnings) # Includes set(INCLUDE_DIR "include") # must be relative paths -target_include_directories(samurai INTERFACE "$" +target_include_directories(samurai PUBLIC "$" "$") # Find dependencies: @@ -122,7 +141,7 @@ endforeach() # Link dependencies: target_link_system_libraries( samurai - INTERFACE + PUBLIC HighFive pugixml::pugixml fmt::fmt @@ -140,7 +159,7 @@ if(SAMURAI_FIELD_CONTAINER MATCHES xtensor) target_link_system_libraries( samurai - INTERFACE + PUBLIC xtensor ) @@ -155,17 +174,17 @@ if(SAMURAI_FIELD_CONTAINER MATCHES eigen3 OR SAMURAI_FLUX_CONTAINER MATCHES eige find_package(Eigen3 CONFIG REQUIRED) target_link_system_libraries( samurai - INTERFACE + PUBLIC Eigen3::Eigen ) - target_compile_definitions(samurai INTERFACE EIGEN_ARRAYBASE_PLUGIN="${CMAKE_CURRENT_SOURCE_DIR}/include/samurai/storage/eigen/array_eigen_addons.hpp") + target_compile_definitions(samurai PUBLIC EIGEN_ARRAYBASE_PLUGIN="${CMAKE_CURRENT_SOURCE_DIR}/include/samurai/storage/eigen/array_eigen_addons.hpp") endif() if(${WITH_OPENMP}) find_package(OpenMP) if(OpenMP_CXX_FOUND) - target_link_libraries(samurai INTERFACE OpenMP::OpenMP_CXX) - target_compile_definitions(samurai INTERFACE SAMURAI_WITH_OPENMP) + target_link_libraries(samurai PUBLIC OpenMP::OpenMP_CXX) + target_compile_definitions(samurai PUBLIC SAMURAI_WITH_OPENMP) else() message(FATAL_ERROR "OpenMP not found") endif() @@ -178,15 +197,14 @@ if(${WITH_MPI}) find_package(Boost REQUIRED COMPONENTS serialization mpi) target_link_system_libraries( samurai - INTERFACE + PUBLIC Boost::serialization Boost::mpi ) - target_compile_definitions(samurai INTERFACE SAMURAI_WITH_MPI) + target_compile_definitions(samurai PUBLIC SAMURAI_WITH_MPI) endif() - -target_compile_features(samurai INTERFACE cxx_std_20) +target_compile_features(samurai PUBLIC cxx_std_20) set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) OPTION(BUILD_BENCHMARKS "samurai benchmark suite" OFF) @@ -199,20 +217,20 @@ option(SAMURAI_CHECK_NAN "Check NaN in computations" OFF) if(WITH_STATS) find_package(nlohmann_json REQUIRED) - target_link_libraries(samurai INTERFACE nlohmann_json::nlohmann_json) - target_compile_definitions(samurai INTERFACE WITH_STATS) + target_link_libraries(samurai PUBLIC nlohmann_json::nlohmann_json) + target_compile_definitions(samurai PUBLIC WITH_STATS) endif() if(SAMURAI_CHECK_NAN) - target_compile_definitions(samurai INTERFACE SAMURAI_CHECK_NAN) + target_compile_definitions(samurai PUBLIC SAMURAI_CHECK_NAN) endif() if(SAMURAI_ENABLE_INLINE) - target_compile_definitions(samurai INTERFACE SAMURAI_ENABLE_INLINE) + target_compile_definitions(samurai PUBLIC SAMURAI_ENABLE_INLINE) endif() if(SAMURAI_FORCE_INLINE) - target_compile_definitions(samurai INTERFACE SAMURAI_FORCE_INLINE) + target_compile_definitions(samurai PUBLIC SAMURAI_FORCE_INLINE) endif() if(BUILD_BENCHMARKS) @@ -234,28 +252,28 @@ else() endif() if(SAMURAI_CONTAINER_LAYOUT_COL_MAJOR) - target_compile_definitions(samurai INTERFACE SAMURAI_CONTAINER_LAYOUT_COL_MAJOR) + target_compile_definitions(samurai PUBLIC SAMURAI_CONTAINER_LAYOUT_COL_MAJOR) endif() if(NOT SAMURAI_FIELD_CONTAINER IN_LIST FIELD_CONTAINER_LIST) message(FATAL_ERROR "SAMURAI_FIELD_CONTAINER must be one of: ${FIELD_CONTAINER_LIST}") else() string(TOUPPER ${SAMURAI_FIELD_CONTAINER} SAMURAI_FIELD_CONTAINER) - target_compile_definitions(samurai INTERFACE SAMURAI_FIELD_CONTAINER_${SAMURAI_FIELD_CONTAINER}) + target_compile_definitions(samurai PUBLIC SAMURAI_FIELD_CONTAINER_${SAMURAI_FIELD_CONTAINER}) endif() if(NOT SAMURAI_FLUX_CONTAINER IN_LIST FLUX_CONTAINER_LIST) message(FATAL_ERROR "SAMURAI_FLUX_CONTAINER must be one of: ${FLUX_CONTAINER_LIST}") else() string(TOUPPER ${SAMURAI_FLUX_CONTAINER} SAMURAI_FLUX_CONTAINER) - target_compile_definitions(samurai INTERFACE SAMURAI_FLUX_CONTAINER_${SAMURAI_FLUX_CONTAINER}) + target_compile_definitions(samurai PUBLIC SAMURAI_FLUX_CONTAINER_${SAMURAI_FLUX_CONTAINER}) endif() if(NOT SAMURAI_STATIC_MAT_CONTAINER IN_LIST STATIC_MATRIX_CONTAINER_LIST) message(FATAL_ERROR "SAMURAI_STATIC_MAT_CONTAINER must be one of: ${STATIC_MATRIX_CONTAINER_LIST}") else() string(TOUPPER ${SAMURAI_STATIC_MAT_CONTAINER} SAMURAI_STATIC_MAT_CONTAINER) - target_compile_definitions(samurai INTERFACE SAMURAI_STATIC_MAT_CONTAINER_${SAMURAI_STATIC_MAT_CONTAINER}) + target_compile_definitions(samurai PUBLIC SAMURAI_STATIC_MAT_CONTAINER_${SAMURAI_STATIC_MAT_CONTAINER}) endif() # Package the project diff --git a/demos/FiniteVolume/CMakeLists.txt b/demos/FiniteVolume/CMakeLists.txt index 3c23b6957..cfbb34df0 100644 --- a/demos/FiniteVolume/CMakeLists.txt +++ b/demos/FiniteVolume/CMakeLists.txt @@ -51,7 +51,7 @@ if(${WITH_PETSC}) add_executable(${executable_name} ${source_file}) target_compile_definitions(${executable_name} PUBLIC SAMURAI_WITH_PETSC) - target_link_libraries(${executable_name} samurai ${PETSC_LINK_LIBRARIES}) + target_link_libraries(${executable_name} PUBLIC samurai ${PETSC_LINK_LIBRARIES}) endforeach() endif() @@ -62,7 +62,7 @@ foreach(demo_entry ${STANDARD_DEMOS}) list(GET demo_parts 1 executable_name) add_executable(${executable_name} ${source_file}) - target_link_libraries(${executable_name} samurai) + target_link_libraries(${executable_name} PUBLIC samurai) endforeach() # Specific options for MSVC diff --git a/include/samurai/array_of_interval_and_point.hpp b/include/samurai/array_of_interval_and_point.hpp index 78e178575..423b5fc57 100644 --- a/include/samurai/array_of_interval_and_point.hpp +++ b/include/samurai/array_of_interval_and_point.hpp @@ -1,8 +1,9 @@ #pragma once +#include "samurai_config.hpp" + namespace samurai { - template class ArrayOfIntervalAndPoint { @@ -83,6 +84,18 @@ namespace samurai std::vector m_idx; }; + //////////////////////////////////////////////////////////////////// + //// explicit instanciation + //////////////////////////////////////////////////////////////////// + + extern template class ArrayOfIntervalAndPoint>>; + extern template class ArrayOfIntervalAndPoint>>; + extern template class ArrayOfIntervalAndPoint>>; + + //////////////////////////////////////////////////////////////////// + //// method implementation + //////////////////////////////////////////////////////////////////// + template void ArrayOfIntervalAndPoint::sort_intervals() { @@ -136,4 +149,5 @@ namespace samurai }); m_idx.erase(it, m_idx.end()); } -} + +} // namespace samurai diff --git a/include/samurai/box.hpp b/include/samurai/box.hpp index 3bbd72dd8..830801415 100644 --- a/include/samurai/box.hpp +++ b/include/samurai/box.hpp @@ -65,6 +65,14 @@ namespace samurai point_t m_max_corner{0}; }; + //////////////////////////////// + // Box explicit instanciation // + //////////////////////////////// + + extern template class Box; + extern template class Box; + extern template class Box; + //////////////////////// // Box implementation // //////////////////////// @@ -361,4 +369,5 @@ namespace samurai approx_box.max_corner() = box.min_corner() + approx_length; return approx_box; } + } // namespace samurai diff --git a/include/samurai/cell.hpp b/include/samurai/cell.hpp index dffa6cdee..2cb02e8ed 100644 --- a/include/samurai/cell.hpp +++ b/include/samurai/cell.hpp @@ -9,6 +9,7 @@ #include #include +#include "interval.hpp" #include "samurai_config.hpp" namespace samurai @@ -76,6 +77,18 @@ namespace samurai double length = 0; }; + //////////////////////////////////////////////////////////////////// + //// explicit instanciation + //////////////////////////////////////////////////////////////////// + + extern template struct Cell<1, default_config::interval_t>; + extern template struct Cell<2, default_config::interval_t>; + extern template struct Cell<3, default_config::interval_t>; + + //////////////////////////////////////////////////////////////////// + //// method implementation + //////////////////////////////////////////////////////////////////// + template SAMURAI_INLINE Cell::Cell(const coords_t& origin_point_, double scaling_factor, @@ -170,4 +183,5 @@ namespace samurai { return !(c1 == c2); } + } // namespace samurai diff --git a/include/samurai/cell_array.hpp b/include/samurai/cell_array.hpp index 3c0c726d4..d66091a03 100644 --- a/include/samurai/cell_array.hpp +++ b/include/samurai/cell_array.hpp @@ -168,6 +168,14 @@ namespace samurai #endif }; + //////////////////////////////////////////////////////////////////// + //// explicit instanciation + //////////////////////////////////////////////////////////////////// + + extern template class CellArray<1>; + extern template class CellArray<2>; + extern template class CellArray<3>; + //////////////////////////////////// // CellArray_iterator definition // /////////////////////////////////// diff --git a/include/samurai/cell_list.hpp b/include/samurai/cell_list.hpp index 75fb25a96..c5030c598 100644 --- a/include/samurai/cell_list.hpp +++ b/include/samurai/cell_list.hpp @@ -46,6 +46,14 @@ namespace samurai std::array m_cells; }; + //////////////////////////////////////////////////////////////////// + //// explicit instanciation + //////////////////////////////////////////////////////////////////// + + extern template class CellList<1>; + extern template class CellList<2>; + extern template class CellList<3>; + ///////////////////////////// // CellList implementation // ///////////////////////////// @@ -121,4 +129,5 @@ namespace samurai cell_list.to_stream(out); return out; } + } // namespace samurai diff --git a/include/samurai/domain_builder.hpp b/include/samurai/domain_builder.hpp index 60452f42b..cb6dc90d2 100644 --- a/include/samurai/domain_builder.hpp +++ b/include/samurai/domain_builder.hpp @@ -115,4 +115,12 @@ namespace samurai return largest_subdivision; } }; + + //////////////////////////////////////////////////////////////////// + //// explicit instanciation + //////////////////////////////////////////////////////////////////// + + extern template class DomainBuilder<1>; + extern template class DomainBuilder<2>; + extern template class DomainBuilder<3>; } diff --git a/include/samurai/field/scalar_field.hpp b/include/samurai/field/scalar_field.hpp index 6ba8cc335..559b6418e 100644 --- a/include/samurai/field/scalar_field.hpp +++ b/include/samurai/field/scalar_field.hpp @@ -10,6 +10,7 @@ #include "../concepts.hpp" #include "../field_expression.hpp" #include "../mesh_holder.hpp" +#include "../mr/mesh.hpp" #include "../numeric/gauss_legendre.hpp" #include "access_base.hpp" #include "field_base.hpp" @@ -109,6 +110,26 @@ namespace samurai ~ScalarField() = default; }; + //////////////////////////////////////////////////////////////////// + //// explicit instanciation + //////////////////////////////////////////////////////////////////// + + extern template class ScalarField>, float>; + extern template class ScalarField>, float>; + extern template class ScalarField>, float>; + + extern template class ScalarField>, double>; + extern template class ScalarField>, double>; + extern template class ScalarField>, double>; + + extern template class ScalarField>, long double>; + extern template class ScalarField>, long double>; + extern template class ScalarField>, long double>; + + //////////////////////////////////////////////////////////////////// + //// methods implementations + //////////////////////////////////////////////////////////////////// + // ScalarField constructors ----------------------------------------------- template diff --git a/include/samurai/field/vector_field.hpp b/include/samurai/field/vector_field.hpp index 121a9ccbd..97c580ca9 100644 --- a/include/samurai/field/vector_field.hpp +++ b/include/samurai/field/vector_field.hpp @@ -9,8 +9,10 @@ #include #include "../algorithm.hpp" +#include "../concepts.hpp" #include "../field_expression.hpp" #include "../mesh_holder.hpp" +#include "../mr/mesh.hpp" #include "../numeric/gauss_legendre.hpp" #include "access_base.hpp" #include "concepts.hpp" @@ -172,6 +174,31 @@ namespace samurai ~VectorField() = default; }; + //////////////////////////////////////////////////////////////////// + //// explicit instanciation + //////////////////////////////////////////////////////////////////// + + extern template class VectorField>, float, 1, false>; + extern template class VectorField>, float, 1, true>; + extern template class VectorField>, float, 2, false>; + extern template class VectorField>, float, 2, true>; + extern template class VectorField>, float, 3, false>; + extern template class VectorField>, float, 3, true>; + + extern template class VectorField>, double, 1, false>; + extern template class VectorField>, double, 1, true>; + extern template class VectorField>, double, 2, false>; + extern template class VectorField>, double, 2, true>; + extern template class VectorField>, double, 3, false>; + extern template class VectorField>, double, 3, true>; + + extern template class VectorField>, long double, 1, false>; + extern template class VectorField>, long double, 1, true>; + extern template class VectorField>, long double, 2, false>; + extern template class VectorField>, long double, 2, true>; + extern template class VectorField>, long double, 3, false>; + extern template class VectorField>, long double, 3, true>; + // VectorField constructors ----------------------------------------------- template diff --git a/include/samurai/interval.hpp b/include/samurai/interval.hpp index 132b02d76..7cff28c62 100644 --- a/include/samurai/interval.hpp +++ b/include/samurai/interval.hpp @@ -99,6 +99,12 @@ namespace samurai #endif }; + //////////////////////////////////////////////////////////////////// + //// explicit instanciation + //////////////////////////////////////////////////////////////////// + + extern template struct Interval; + ///////////////////////////// // Interval implementation // ///////////////////////////// diff --git a/include/samurai/level_cell_array.hpp b/include/samurai/level_cell_array.hpp index 06a4b83d6..dda857a1e 100644 --- a/include/samurai/level_cell_array.hpp +++ b/include/samurai/level_cell_array.hpp @@ -322,6 +322,14 @@ namespace samurai mutable coord_type m_index; }; + //////////////////////////////////////////////////////////////////// + //// explicit instanciation + //////////////////////////////////////////////////////////////////// + + extern template class LevelCellArray<1>; + extern template class LevelCellArray<2>; + extern template class LevelCellArray<3>; + /////////////////////////////////// // LevelCellArray implementation // /////////////////////////////////// @@ -1370,4 +1378,5 @@ namespace samurai { return it1.base().equal(it2.base()); } + } // namespace samurai diff --git a/include/samurai/level_cell_list.hpp b/include/samurai/level_cell_list.hpp index 153b09dbf..33ebd796d 100644 --- a/include/samurai/level_cell_list.hpp +++ b/include/samurai/level_cell_list.hpp @@ -103,6 +103,14 @@ namespace samurai double m_scaling_factor = 1; }; + //////////////////////////////////////////////////////////////////// + //// explicit instanciation + //////////////////////////////////////////////////////////////////// + + extern template class LevelCellList<1>; + extern template class LevelCellList<2>; + extern template class LevelCellList<3>; + ////////////////////////////////// // LevelCellList implementation // ////////////////////////////////// @@ -129,11 +137,11 @@ namespace samurai } /// Constant access to the interval list at given dim-1 coordinates - template - SAMURAI_INLINE auto LevelCellList::operator[](const index_yz_t& index) const -> const list_interval_t& - { - return detail::access_grid_yz(m_grid_yz, index, std::integral_constant{}); - } + //~ template + //~ SAMURAI_INLINE auto LevelCellList::operator[](const index_yz_t& index) const -> const list_interval_t& + //~ { + //~ return detail::access_grid_yz(m_grid_yz, index, std::integral_constant{}); + //~ } /// Mutable access to the interval list at given dim-1 coordinates template diff --git a/include/samurai/list_of_intervals.hpp b/include/samurai/list_of_intervals.hpp index 72e6c6cfc..5b8e308bf 100644 --- a/include/samurai/list_of_intervals.hpp +++ b/include/samurai/list_of_intervals.hpp @@ -65,6 +65,12 @@ namespace samurai void add_interval(const interval_t& interval); }; + //////////////////////////////////////////////////////////////////// + //// explicit instanciation + //////////////////////////////////////////////////////////////////// + + extern template struct ListOfIntervals; + //////////////////////////////////// // ListOfIntervals implementation // //////////////////////////////////// diff --git a/include/samurai/mesh_interval.hpp b/include/samurai/mesh_interval.hpp index ae8cfa9cd..7ecc290c4 100644 --- a/include/samurai/mesh_interval.hpp +++ b/include/samurai/mesh_interval.hpp @@ -2,6 +2,9 @@ #include #include +#include "interval.hpp" +#include "samurai_config.hpp" + using namespace xt::placeholders; namespace samurai @@ -37,6 +40,10 @@ namespace samurai } }; + extern template struct MeshInterval<1, default_config::interval_t>; + extern template struct MeshInterval<2, default_config::interval_t>; + extern template struct MeshInterval<3, default_config::interval_t>; + template MeshInterval operator+(const MeshInterval& mi, const xt::xtensor_fixed>& translate) diff --git a/include/samurai/mr/adapt.hpp b/include/samurai/mr/adapt.hpp index 0314ce88e..e13247cfa 100644 --- a/include/samurai/mr/adapt.hpp +++ b/include/samurai/mr/adapt.hpp @@ -133,6 +133,80 @@ namespace samurai #endif }; + //////////////////////////////////////////////////////////////////// + //// explicit instanciation + //////////////////////////////////////////////////////////////////// + + extern template class Adapt>, float>>; + extern template class Adapt>, float>>; + extern template class Adapt>, float>>; + + extern template class Adapt>, double>>; + extern template class Adapt>, double>>; + extern template class Adapt>, double>>; + + extern template class Adapt>, long double>>; + extern template class Adapt>, long double>>; + extern template class Adapt>, long double>>; + + extern template class Adapt>, float>>; + extern template class Adapt>, float>>; + extern template class Adapt>, float>>; + + extern template class Adapt>, double>>; + extern template class Adapt>, double>>; + extern template class Adapt>, double>>; + + extern template class Adapt>, long double>>; + extern template class Adapt>, long double>>; + extern template class Adapt>, long double>>; + + extern template class Adapt>, float, 1, false>>; + extern template class Adapt>, float, 1, true>>; + extern template class Adapt>, float, 2, false>>; + extern template class Adapt>, float, 2, true>>; + extern template class Adapt>, float, 3, false>>; + extern template class Adapt>, float, 3, true>>; + + extern template class Adapt>, double, 1, false>>; + extern template class Adapt>, double, 1, true>>; + extern template class Adapt>, double, 2, false>>; + extern template class Adapt>, double, 2, true>>; + extern template class Adapt>, double, 3, false>>; + extern template class Adapt>, double, 3, true>>; + + extern template class Adapt>, long double, 1, false>>; + extern template class Adapt>, long double, 1, true>>; + extern template class Adapt>, long double, 2, false>>; + extern template class Adapt>, long double, 2, true>>; + extern template class Adapt>, long double, 3, false>>; + extern template class Adapt>, long double, 3, true>>; + + extern template class Adapt>, float, 1, false>>; + extern template class Adapt>, float, 1, true>>; + extern template class Adapt>, float, 2, false>>; + extern template class Adapt>, float, 2, true>>; + extern template class Adapt>, float, 3, false>>; + extern template class Adapt>, float, 3, true>>; + + extern template class Adapt>, double, 1, false>>; + extern template class Adapt>, double, 1, true>>; + extern template class Adapt>, double, 2, false>>; + extern template class Adapt>, double, 2, true>>; + extern template class Adapt>, double, 3, false>>; + extern template class Adapt>, double, 3, true>>; + + extern template class Adapt>, long double, 1, false>>; + extern template class Adapt>, long double, 1, true>>; + extern template class Adapt>, long double, 2, false>>; + extern template class Adapt>, long double, 2, true>>; + extern template class Adapt>, long double, 3, false>>; + extern template class Adapt>, long double, 3, true>>; + + //////////////////////////////////////////////////////////////////// + //// method imlementation + //////////////////////////////////////////////////////////////////// + template SAMURAI_INLINE Adapt::Adapt(PredictionFn&& prediction_fn, TField& field, TFields&... fields) : m_prediction_fn(std::forward(prediction_fn)) diff --git a/include/samurai/mr/mesh.hpp b/include/samurai/mr/mesh.hpp index 427049350..57e4e6336 100644 --- a/include/samurai/mr/mesh.hpp +++ b/include/samurai/mr/mesh.hpp @@ -126,6 +126,18 @@ namespace samurai xt::xtensor exists(mesh_id_t type, std::size_t level, interval_t interval, T... index) const; }; + //////////////////////////////////////////////////////////////////// + //// explicit instanciation + //////////////////////////////////////////////////////////////////// + + extern template class MRMesh>; + extern template class MRMesh>; + extern template class MRMesh>; + + //////////////////////////////////////////////////////////////////// + //// methods implementations + //////////////////////////////////////////////////////////////////// + template SAMURAI_INLINE MRMesh::MRMesh(const ca_type& ca, const self_type& ref_mesh) : base_type(ca, ref_mesh) @@ -162,62 +174,6 @@ namespace samurai { } - template - SAMURAI_INLINE MRMesh::MRMesh(const samurai::Box& b, - std::size_t min_level, - std::size_t max_level, - double approx_box_tol, - double scaling_factor_) - : base_type(b, - mesh_config() - .max_stencil_radius(config_t::max_stencil_width) - .graduation_width(config_t::graduation_width) - .start_level(max_level) - .min_level(min_level) - .max_level(max_level) - .approx_box_tol(approx_box_tol) - .scaling_factor(scaling_factor_)) - { - } - - template - SAMURAI_INLINE MRMesh::MRMesh(const samurai::DomainBuilder& domain_builder, - std::size_t min_level, - std::size_t max_level, - double approx_box_tol, - double scaling_factor_) - : base_type(domain_builder, - mesh_config() - .max_stencil_radius(config_t::max_stencil_width) - .graduation_width(config_t::graduation_width) - .start_level(max_level) - .min_level(min_level) - .max_level(max_level) - .approx_box_tol(approx_box_tol) - .scaling_factor(scaling_factor_)) - { - } - - template - SAMURAI_INLINE MRMesh::MRMesh(const samurai::Box& b, - std::size_t min_level, - std::size_t max_level, - const std::array& periodic, - double approx_box_tol, - double scaling_factor_) - : base_type(b, - mesh_config() - .max_stencil_radius(config_t::max_stencil_width) - .graduation_width(config_t::graduation_width) - .start_level(max_level) - .min_level(min_level) - .max_level(max_level) - .periodic(periodic) - .approx_box_tol(approx_box_tol) - .scaling_factor(scaling_factor_)) - { - } - template SAMURAI_INLINE void MRMesh::update_sub_mesh_impl() { diff --git a/include/samurai/reconstruction.hpp b/include/samurai/reconstruction.hpp index 23919fa41..3a6bb69c5 100644 --- a/include/samurai/reconstruction.hpp +++ b/include/samurai/reconstruction.hpp @@ -54,6 +54,7 @@ namespace samurai return coeff[k]; } + /* double& get(std::array index) { return (*this)(index[0]); @@ -68,7 +69,7 @@ namespace samurai { return (*this)(index[0], index[1], index[2]); } - + */ prediction_map& operator+=(const prediction_map& p) { for (const auto& c : p.coeff) @@ -134,6 +135,18 @@ namespace samurai std::unordered_map, double, ArrayHash> coeff; }; + //////////////////////////////////////////////////////////////////// + //// explicit instanciation + //////////////////////////////////////////////////////////////////// + + extern template class prediction_map<1>; + extern template class prediction_map<2>; + extern template class prediction_map<3>; + + //////////////////////////////////////////////////////////////////// + //// methods implementations + //////////////////////////////////////////////////////////////////// + template auto operator+(const prediction_map& p1, const prediction_map& p2) { @@ -499,6 +512,10 @@ namespace samurai } }; + extern template class reconstruction_op_<1, default_config::interval_t>; + extern template class reconstruction_op_<2, default_config::interval_t>; + extern template class reconstruction_op_<3, default_config::interval_t>; + template SAMURAI_INLINE auto make_reconstruction(std::size_t& reconstruct_level, T1&& reconstruct_field, T2&& field) { @@ -936,4 +953,5 @@ namespace samurai } } } + } diff --git a/include/samurai/stencil_field.hpp b/include/samurai/stencil_field.hpp index 474567a75..7e1d7b1c8 100644 --- a/include/samurai/stencil_field.hpp +++ b/include/samurai/stencil_field.hpp @@ -172,6 +172,10 @@ namespace samurai } }; + extern template class upwind_op<1, default_config::interval_t>; + extern template class upwind_op<2, default_config::interval_t>; + extern template class upwind_op<3, default_config::interval_t>; + template SAMURAI_INLINE auto upwind(CT&&... e) { @@ -242,6 +246,10 @@ namespace samurai } }; + extern template class upwind_scalar_burgers_op<1, default_config::interval_t>; + extern template class upwind_scalar_burgers_op<2, default_config::interval_t>; + extern template class upwind_scalar_burgers_op<3, default_config::interval_t>; + template SAMURAI_INLINE auto upwind_scalar_burgers(CT&&... e) { diff --git a/src/samurai/array_of_interval_and_point.cpp b/src/samurai/array_of_interval_and_point.cpp new file mode 100644 index 000000000..d2c105946 --- /dev/null +++ b/src/samurai/array_of_interval_and_point.cpp @@ -0,0 +1,17 @@ +#include // for stable_sort +#include // size_t +#include // for iota +#include // pair +#include +#include // for coord_type + +#include "samurai/array_of_interval_and_point.hpp" +#include "samurai/interval.hpp" +#include "samurai/samurai_config.hpp" + +namespace samurai +{ + template class ArrayOfIntervalAndPoint>>; + template class ArrayOfIntervalAndPoint>>; + template class ArrayOfIntervalAndPoint>>; +} // namespace samurai diff --git a/src/samurai/box.cpp b/src/samurai/box.cpp new file mode 100644 index 000000000..6ae307a4b --- /dev/null +++ b/src/samurai/box.cpp @@ -0,0 +1,10 @@ +#include "samurai/box.hpp" + +namespace samurai +{ + + template class Box; + template class Box; + template class Box; + +} // namespace samurai diff --git a/src/samurai/cell.cpp b/src/samurai/cell.cpp new file mode 100644 index 000000000..9d9574c00 --- /dev/null +++ b/src/samurai/cell.cpp @@ -0,0 +1,10 @@ +#include "samurai/cell.hpp" + +namespace samurai +{ + + template struct Cell<1, default_config::interval_t>; + template struct Cell<2, default_config::interval_t>; + template struct Cell<3, default_config::interval_t>; + +} // namespace samurai diff --git a/src/samurai/cell_array.cpp b/src/samurai/cell_array.cpp new file mode 100644 index 000000000..aa700b8fd --- /dev/null +++ b/src/samurai/cell_array.cpp @@ -0,0 +1,11 @@ +#include "samurai/cell_array.hpp" +#include "samurai/interval.hpp" + +namespace samurai +{ + + template class CellArray<1>; + template class CellArray<2>; + template class CellArray<3>; + +} // namespace samurai diff --git a/src/samurai/cell_list.cpp b/src/samurai/cell_list.cpp new file mode 100644 index 000000000..80d0dc5f3 --- /dev/null +++ b/src/samurai/cell_list.cpp @@ -0,0 +1,11 @@ +#include "samurai/cell_list.hpp" +#include "samurai/interval.hpp" + +namespace samurai +{ + + template class CellList<1>; + template class CellList<2>; + template class CellList<3>; + +} // namespace samurai diff --git a/src/samurai/domain_builder.cpp b/src/samurai/domain_builder.cpp new file mode 100644 index 000000000..415b36fa5 --- /dev/null +++ b/src/samurai/domain_builder.cpp @@ -0,0 +1,10 @@ +#include "samurai/domain_builder.hpp" + +namespace samurai +{ + + template class DomainBuilder<1>; + template class DomainBuilder<2>; + template class DomainBuilder<3>; + +} // namespace samurai diff --git a/src/samurai/field/scalar_field.cpp b/src/samurai/field/scalar_field.cpp new file mode 100644 index 000000000..04039f466 --- /dev/null +++ b/src/samurai/field/scalar_field.cpp @@ -0,0 +1,16 @@ +#include "samurai/field/scalar_field.hpp" + +namespace samurai +{ + template class ScalarField>, float>; + template class ScalarField>, float>; + template class ScalarField>, float>; + + template class ScalarField>, double>; + template class ScalarField>, double>; + template class ScalarField>, double>; + + template class ScalarField>, long double>; + template class ScalarField>, long double>; + template class ScalarField>, long double>; +} // namespace samurai diff --git a/src/samurai/field/vector_field.cpp b/src/samurai/field/vector_field.cpp new file mode 100644 index 000000000..a6c4a3188 --- /dev/null +++ b/src/samurai/field/vector_field.cpp @@ -0,0 +1,25 @@ +#include "samurai/field/vector_field.hpp" + +namespace samurai +{ + template class VectorField>, float, 1, false>; + template class VectorField>, float, 1, true>; + template class VectorField>, float, 2, false>; + template class VectorField>, float, 2, true>; + template class VectorField>, float, 3, false>; + template class VectorField>, float, 3, true>; + + template class VectorField>, double, 1, false>; + template class VectorField>, double, 1, true>; + template class VectorField>, double, 2, false>; + template class VectorField>, double, 2, true>; + template class VectorField>, double, 3, false>; + template class VectorField>, double, 3, true>; + + template class VectorField>, long double, 1, false>; + template class VectorField>, long double, 1, true>; + template class VectorField>, long double, 2, false>; + template class VectorField>, long double, 2, true>; + template class VectorField>, long double, 3, false>; + template class VectorField>, long double, 3, true>; +} // namespace samurai diff --git a/src/samurai/interval.cpp b/src/samurai/interval.cpp new file mode 100644 index 000000000..4a80b4a4b --- /dev/null +++ b/src/samurai/interval.cpp @@ -0,0 +1,8 @@ +#include "samurai/interval.hpp" + +namespace samurai +{ + + template struct Interval; + +} // namespace samurai diff --git a/src/samurai/level_cell_array.cpp b/src/samurai/level_cell_array.cpp new file mode 100644 index 000000000..da79e91fb --- /dev/null +++ b/src/samurai/level_cell_array.cpp @@ -0,0 +1,11 @@ +#include "samurai/level_cell_array.hpp" +#include "samurai/interval.hpp" + +namespace samurai +{ + + template class LevelCellArray<1>; + template class LevelCellArray<2>; + template class LevelCellArray<3>; + +} // namespace samurai diff --git a/src/samurai/level_cell_list.cpp b/src/samurai/level_cell_list.cpp new file mode 100644 index 000000000..77cab6647 --- /dev/null +++ b/src/samurai/level_cell_list.cpp @@ -0,0 +1,11 @@ +#include "samurai/level_cell_list.hpp" +#include "samurai/interval.hpp" + +namespace samurai +{ + + template class LevelCellList<1>; + template class LevelCellList<2>; + template class LevelCellList<3>; + +} // namespace samurai diff --git a/src/samurai/list_of_intervals.cpp b/src/samurai/list_of_intervals.cpp new file mode 100644 index 000000000..6a50a7f5d --- /dev/null +++ b/src/samurai/list_of_intervals.cpp @@ -0,0 +1,9 @@ +#include "samurai/list_of_intervals.hpp" +#include "samurai/interval.hpp" + +namespace samurai +{ + + template struct ListOfIntervals; + +} // namespace samurai diff --git a/src/samurai/mesh_interval.cpp b/src/samurai/mesh_interval.cpp new file mode 100644 index 000000000..810622f30 --- /dev/null +++ b/src/samurai/mesh_interval.cpp @@ -0,0 +1,11 @@ +#include "samurai/mesh_interval.hpp" +#include "samurai/interval.hpp" + +namespace samurai +{ + + template struct MeshInterval<1, default_config::interval_t>; + template struct MeshInterval<2, default_config::interval_t>; + template struct MeshInterval<3, default_config::interval_t>; + +} // namespace samurai diff --git a/src/samurai/mr/adapt.cpp b/src/samurai/mr/adapt.cpp new file mode 100644 index 000000000..63f6c70c2 --- /dev/null +++ b/src/samurai/mr/adapt.cpp @@ -0,0 +1,70 @@ +#include "samurai/mr/adapt.hpp" + +namespace samurai +{ + template class Adapt>, float>>; + template class Adapt>, float>>; + template class Adapt>, float>>; + + template class Adapt>, double>>; + template class Adapt>, double>>; + template class Adapt>, double>>; + + template class Adapt>, long double>>; + template class Adapt>, long double>>; + template class Adapt>, long double>>; + + template class Adapt>, float>>; + template class Adapt>, float>>; + template class Adapt>, float>>; + + template class Adapt>, double>>; + template class Adapt>, double>>; + template class Adapt>, double>>; + + template class Adapt>, long double>>; + template class Adapt>, long double>>; + template class Adapt>, long double>>; + + template class Adapt>, float, 1, false>>; + template class Adapt>, float, 1, true>>; + template class Adapt>, float, 2, false>>; + template class Adapt>, float, 2, true>>; + template class Adapt>, float, 3, false>>; + template class Adapt>, float, 3, true>>; + + template class Adapt>, double, 1, false>>; + template class Adapt>, double, 1, true>>; + template class Adapt>, double, 2, false>>; + template class Adapt>, double, 2, true>>; + template class Adapt>, double, 3, false>>; + template class Adapt>, double, 3, true>>; + + template class Adapt>, long double, 1, false>>; + template class Adapt>, long double, 1, true>>; + template class Adapt>, long double, 2, false>>; + template class Adapt>, long double, 2, true>>; + template class Adapt>, long double, 3, false>>; + template class Adapt>, long double, 3, true>>; + + template class Adapt>, float, 1, false>>; + template class Adapt>, float, 1, true>>; + template class Adapt>, float, 2, false>>; + template class Adapt>, float, 2, true>>; + template class Adapt>, float, 3, false>>; + template class Adapt>, float, 3, true>>; + + template class Adapt>, double, 1, false>>; + template class Adapt>, double, 1, true>>; + template class Adapt>, double, 2, false>>; + template class Adapt>, double, 2, true>>; + template class Adapt>, double, 3, false>>; + template class Adapt>, double, 3, true>>; + + template class Adapt>, long double, 1, false>>; + template class Adapt>, long double, 1, true>>; + template class Adapt>, long double, 2, false>>; + template class Adapt>, long double, 2, true>>; + template class Adapt>, long double, 3, false>>; + template class Adapt>, long double, 3, true>>; +} // namespace samurai diff --git a/src/samurai/mr/mesh.cpp b/src/samurai/mr/mesh.cpp new file mode 100644 index 000000000..ab7080112 --- /dev/null +++ b/src/samurai/mr/mesh.cpp @@ -0,0 +1,8 @@ +#include "samurai/mr/mesh.hpp" + +namespace samurai +{ + template class MRMesh>; + template class MRMesh>; + template class MRMesh>; +} diff --git a/src/samurai/reconstruction.cpp b/src/samurai/reconstruction.cpp new file mode 100644 index 000000000..b60295c79 --- /dev/null +++ b/src/samurai/reconstruction.cpp @@ -0,0 +1,15 @@ +#include "samurai/reconstruction.hpp" +#include "samurai/interval.hpp" + +namespace samurai +{ + + template class prediction_map<1>; + template class prediction_map<2>; + template class prediction_map<3>; + + template class reconstruction_op_<1, default_config::interval_t>; + template class reconstruction_op_<2, default_config::interval_t>; + template class reconstruction_op_<3, default_config::interval_t>; + +} // namespace samurai diff --git a/src/samurai/stencil_field.cpp b/src/samurai/stencil_field.cpp new file mode 100644 index 000000000..ba4321090 --- /dev/null +++ b/src/samurai/stencil_field.cpp @@ -0,0 +1,14 @@ +#include "samurai/stencil_field.hpp" + +namespace samurai +{ + + template class upwind_op<1, default_config::interval_t>; + template class upwind_op<2, default_config::interval_t>; + template class upwind_op<3, default_config::interval_t>; + + template class upwind_scalar_burgers_op<1, default_config::interval_t>; + template class upwind_scalar_burgers_op<2, default_config::interval_t>; + template class upwind_scalar_burgers_op<3, default_config::interval_t>; + +} // namespace samurai