From 5d971ef35097352daf183ba9335d818fa411f842 Mon Sep 17 00:00:00 2001 From: Benjamin Curtice Corbett Date: Wed, 18 Sep 2019 17:25:45 -0700 Subject: [PATCH 1/5] Added support for permuted Arrays, permutation is not output to restart. --- integratedTests | 2 +- .../codingUtilities/GeosxTraits.hpp | 16 +- .../codingUtilities/UnitTestUtilities.hpp | 42 ++--- .../codingUtilities/Utilities.hpp | 22 +-- .../codingUtilities/tests/testGeosxTraits.cpp | 8 +- src/coreComponents/common/DataTypes.hpp | 117 +++++++------- .../common/unitTests/CMakeLists.txt | 1 - .../constitutive/unitTests/CMakeLists.txt | 1 - .../unitTests/testCapillaryPressure.cpp | 128 ++------------- .../constitutive/unitTests/testMultiFluid.cpp | 148 ++++-------------- .../constitutive/unitTests/testRelPerm.cpp | 128 ++------------- src/coreComponents/cxx-utilities | 2 +- .../dataRepository/BufferOps.hpp | 92 ++++++----- .../dataRepository/BufferOps_inline.hpp | 96 ++++++------ .../unitTests/testDefaultValue.cpp | 13 +- .../unitTests/testSidreExtended.cpp | 8 +- .../unitTests/testXmlWrapper.cpp | 22 +-- .../dataRepository/xmlWrapper.hpp | 4 +- .../fileIO/blueprint/Blueprint.cpp | 39 ++--- .../schema/docs/BlackOilFluid_other.rst | 48 +++--- ...ksCoreyBakerRelativePermeability_other.rst | 14 +- .../BrooksCoreyCapillaryPressure_other.rst | 16 +- .../BrooksCoreyRelativePermeability_other.rst | 14 +- .../CompositionalMultiphaseFluid_other.rst | 48 +++--- .../docs/LinearElasticAnisotropic_other.rst | 18 +-- .../PoroLinearElasticAnisotropic_other.rst | 22 +-- ...nuchtenBakerRelativePermeability_other.rst | 14 +- .../VanGenuchtenCapillaryPressure_other.rst | 16 +- ...WellElementRegionuniqueSubRegion_other.rst | 42 ++--- .../fileIO/schema/docs/default_other.rst | 44 +++--- .../fileIO/schema/docs/domain_other.rst | 18 +-- .../fileIO/schema/docs/edgeManager_other.rst | 42 ++--- .../fileIO/schema/schema.xsd.other | 54 +++---- src/coreComponents/fileIO/silo/SiloFile.cpp | 3 +- .../ElementLibrary/FiniteElement.h | 133 ++++++++-------- .../ElementLibrary/FiniteElementBase.h | 4 +- .../ElementLibrary/TetrahedralElement.cpp | 55 ------- .../ElementLibrary/TetrahedralElement.hpp | 61 +++++++- .../FiniteElementDiscretization.cpp | 30 ---- .../FiniteElementDiscretization.hpp | 40 ++++- .../finiteVolume/unitTests/CMakeLists.txt | 1 - .../linearAlgebra/DofManager.cpp | 10 +- .../linearAlgebra/unitTests/CMakeLists.txt | 1 - .../managers/DomainPartition.cpp | 22 ++- .../FieldSpecificationBase.hpp | 8 +- .../managers/ObjectManagerBase.cpp | 12 +- .../managers/ObjectManagerBase.hpp | 10 +- .../managers/unitTests/testMeshGeneration.cpp | 2 +- .../mesh/AggregateElementSubRegion.hpp | 20 --- src/coreComponents/mesh/CellBlock.hpp | 31 ++-- .../mesh/CellElementSubRegion.cpp | 9 +- src/coreComponents/mesh/EdgeManager.cpp | 2 +- .../mesh/ElementSubRegionBase.hpp | 5 +- .../mesh/FaceElementSubRegion.cpp | 2 +- .../mesh/FaceElementSubRegion.hpp | 11 -- .../mesh/InterObjectRelation.hpp | 5 + src/coreComponents/mesh/MeshLevel.cpp | 6 +- src/coreComponents/mesh/NodeManager.cpp | 14 +- .../meshUtilities/InternalMeshGenerator.cpp | 2 +- .../mpiCommunications/CommunicationTools.cpp | 23 ++- .../mpiCommunications/CommunicationTools.hpp | 2 + .../NeighborCommunicator.cpp | 48 +++--- .../CoupledSolvers/PoroelasticSolver.cpp | 4 +- .../FiniteVolume/SinglePhaseFlow.cpp | 1 - .../SimpleSolvers/LaplaceFEM.cpp | 6 +- .../SolidMechanicsLagrangianFEM.cpp | 10 +- .../SolidMechanicsLagrangianFEM.hpp | 4 +- .../SolidMechanicsLagrangianFEMKernels.hpp | 4 +- .../SolidMechanicsLagrangianSSLE.cpp | 2 +- .../SolidMechanicsLagrangianSSLE.hpp | 4 +- .../SolidMechanicsLagrangianSSLEKernels.hpp | 8 +- .../surfaceGeneration/SurfaceGenerator.cpp | 44 +++--- .../surfaceGeneration/SurfaceGenerator.hpp | 16 +- .../physicsSolvers/unitTests/CMakeLists.txt | 2 - .../unitTests/testCompFlowUtils.hpp | 106 +++++++------ .../unitTests/testCompMultiphaseFlow.cpp | 50 ++++-- .../unitTests/testFlowKernelHelpers.hpp | 16 +- ...eservoirCompositionalMultiphaseMSWells.cpp | 2 +- .../testReservoirSinglePhaseMSWells.cpp | 2 +- .../unitTests/testSinglePhaseFlowKernels.cpp | 6 - .../rajaInterface/GEOS_RAJA_Interface.hpp | 60 +------ .../wells/InternalWellGenerator.hpp | 18 +-- src/coreComponents/wells/PerforationData.cpp | 6 +- .../wells/WellElementRegion.cpp | 2 +- .../wells/WellElementSubRegion.cpp | 17 +- .../wells/WellElementSubRegion.hpp | 32 ++-- 86 files changed, 972 insertions(+), 1321 deletions(-) diff --git a/integratedTests b/integratedTests index f985b7d4e46..732dca816a2 160000 --- a/integratedTests +++ b/integratedTests @@ -1 +1 @@ -Subproject commit f985b7d4e46a20ed9e579db4eed90dbfb0e062a7 +Subproject commit 732dca816a2683a7af5f74422a903e0c8d05e885 diff --git a/src/coreComponents/codingUtilities/GeosxTraits.hpp b/src/coreComponents/codingUtilities/GeosxTraits.hpp index 3e646bfdf28..fb5c14c361a 100644 --- a/src/coreComponents/codingUtilities/GeosxTraits.hpp +++ b/src/coreComponents/codingUtilities/GeosxTraits.hpp @@ -47,8 +47,8 @@ constexpr bool is_set = is_instantiation_of_v; template constexpr bool is_array = false; -template< typename T, int NDIM, typename INDEX_TYPE > -constexpr bool is_array< LvArray::Array > = true; +template< typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE > +constexpr bool is_array< LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > > = true; template constexpr bool is_tensorT = is_instance_of_v || @@ -81,14 +81,14 @@ constexpr bool is_noncontainer_type_packable::value; template struct is_packable_array : std::false_type {}; -template -struct is_packable_array< LvArray::Array > : is_packable {}; +template +struct is_packable_array< LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > > : is_packable {}; -template -struct is_packable_array< LvArray::ArrayView > : is_packable {}; +template +struct is_packable_array< LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > > : is_packable {}; -template -struct is_packable_array< LvArray::ArraySlice > : is_packable {}; +template +struct is_packable_array< LvArray::ArraySlice< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > > : is_packable {}; template struct is_packable_array< LvArray::ArrayOfArrays > : is_packable {}; diff --git a/src/coreComponents/codingUtilities/UnitTestUtilities.hpp b/src/coreComponents/codingUtilities/UnitTestUtilities.hpp index 77752bba279..ea058739bbe 100644 --- a/src/coreComponents/codingUtilities/UnitTestUtilities.hpp +++ b/src/coreComponents/codingUtilities/UnitTestUtilities.hpp @@ -29,21 +29,16 @@ namespace geosx namespace testing { -template< typename T > -::testing::AssertionResult checkRelativeErrorFormat( const char *, const char *, const char *, - T v1, T v2, T relTol ) -{ - T const delta = std::abs( v1 - v2 ); - T const value = std::max( std::abs( v1 ), std::abs( v2 )); - - if( delta < 1E-13 ) - { - return ::testing::AssertionSuccess(); - } +constexpr real64 DEFAULT_ABS_TOL = 1E-13; - if( delta > relTol * value ) +::testing::AssertionResult checkRelativeErrorFormat( const char *, const char *, const char *, const char *, + real64 const v1, real64 const v2, real64 const relTol, real64 const absTol ) +{ + real64 const delta = std::abs( v1 - v2 ); + real64 const value = std::max( std::abs(v1), std::abs(v2) ); + if (delta > absTol && delta > relTol * value) { - return ::testing::AssertionFailure() << std::scientific << std::setprecision( 5 ) + return ::testing::AssertionFailure() << std::scientific << std::setprecision(5) << " relative error: " << delta / value << " (" << v1 << " vs " << v2 << ")," << " exceeds " << relTol << std::endl; @@ -51,17 +46,26 @@ ::testing::AssertionResult checkRelativeErrorFormat( const char *, const char *, return ::testing::AssertionSuccess(); } -template< typename T > -void checkRelativeError( T v1, T v2, T relTol ) +::testing::AssertionResult checkRelativeErrorFormat( char const * a, char const * b, char const * c, + real64 const v1, real64 const v2, real64 const relTol ) +{ return checkRelativeErrorFormat( a, b, c, "DEFAULT_ABS_TOL", v1, v2, relTol, DEFAULT_ABS_TOL ); } + +void checkRelativeError( real64 const v1, real64 const v2, real64 const relTol ) +{ EXPECT_PRED_FORMAT3( checkRelativeErrorFormat, v1, v2, relTol ); } + +void checkRelativeError( real64 const v1, real64 const v2, real64 const relTol, real64 const absTol ) +{ EXPECT_PRED_FORMAT4( checkRelativeErrorFormat, v1, v2, relTol, absTol ); } + +void checkRelativeError( real64 const v1, real64 const v2, real64 const relTol, string const & name ) { + SCOPED_TRACE( name ); EXPECT_PRED_FORMAT3( checkRelativeErrorFormat, v1, v2, relTol ); } -template< typename T > -void checkRelativeError( T v1, T v2, T relTol, string const & name ) +void checkRelativeError( real64 const v1, real64 const v2, real64 const relTol, real64 const absTol, string const & name ) { - SCOPED_TRACE( name ); - EXPECT_PRED_FORMAT3( checkRelativeErrorFormat, v1, v2, relTol ); + SCOPED_TRACE(name); + EXPECT_PRED_FORMAT4( checkRelativeErrorFormat, v1, v2, relTol, absTol ); } void compareMatrixRow( globalIndex rowNumber, real64 relTol, diff --git a/src/coreComponents/codingUtilities/Utilities.hpp b/src/coreComponents/codingUtilities/Utilities.hpp index 1dc5c09fb44..effbc2c3586 100644 --- a/src/coreComponents/codingUtilities/Utilities.hpp +++ b/src/coreComponents/codingUtilities/Utilities.hpp @@ -24,13 +24,13 @@ namespace geosx { -template< typename T > -inline void CopyGlobalToLocal(arraySlice1d const & globalToLocalRelation, +template< typename T, int UNIT_STRIDE_DIM > +inline void CopyGlobalToLocal(arraySlice1d< localIndex const, UNIT_STRIDE_DIM> const & globalToLocalRelation, arraySlice1d< T const> const& globalField1, arraySlice1d< T const> const& globalField2, - arraySlice1d< T > & localField1, - arraySlice1d< T > & localField2, - localIndex N) + arraySlice1d< T > const & localField1, + arraySlice1d< T > const & localField2, + localIndex const N) { for( localIndex a=0 ; a const & globalToLoc } } -template< localIndex N, typename T > -inline void CopyGlobalToLocal(arraySlice1d const & globalToLocalRelation, +template< localIndex N, typename T, int UNIT_STRIDE_DIM > +inline void CopyGlobalToLocal(arraySlice1d< localIndex const, UNIT_STRIDE_DIM > const & globalToLocalRelation, arraySlice1d< T const > const & globalField1, arraySlice1d< T const > const & globalField2, T * const restrict localField1, @@ -53,8 +53,8 @@ inline void CopyGlobalToLocal(arraySlice1d const & globalToLo } } -template< localIndex N, typename T > -inline void CopyGlobalToLocal(arraySlice1d const & globalToLocalRelation, +template< localIndex N, typename T, int UNIT_STRIDE_DIM > +inline void CopyGlobalToLocal(arraySlice1d< localIndex, UNIT_STRIDE_DIM > const & globalToLocalRelation, arraySlice1d< T > const & globalField1, arraySlice1d< T > const & globalField2, arraySlice1d< T > const & globalField3, @@ -70,8 +70,8 @@ inline void CopyGlobalToLocal(arraySlice1d const & globalToLocalRela } } -template< int N, typename T > -inline void CopyGlobalToLocal(arraySlice1d const & globalToLocalRelation, +template< int N, typename T, int UNIT_STRIDE_DIM > +inline void CopyGlobalToLocal(arraySlice1d< localIndex const, UNIT_STRIDE_DIM > const & globalToLocalRelation, arraySlice1d< T const > const & globalField1, arraySlice1d< T const > const & globalField2, arraySlice1d< T const > const & globalField3, diff --git a/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp b/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp index 69e4ae71dfd..936e1ba433d 100644 --- a/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp +++ b/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp @@ -43,7 +43,7 @@ TEST(testGeosxTraits,test_is_string) TEST(testGeosxTraits,test_is_array) { - static_assert(is_array>, "Should be true"); + static_assert(is_array< LvArray::Array< int, 1, camp::make_idx_seq< 0 >::type, int > >, "Should be true"); static_assert(!is_array, "Should be false"); static_assert(!is_array, "Should be false"); @@ -98,10 +98,10 @@ TEST(testGeosxTraits,test_is_noncontainer_type_packable) TEST(testGeosxTraits,test_is_array_packable) { - using arrayType = LvArray::Array; + using arrayType = LvArray::Array::type,long int>; EXPECT_TRUE( is_packable_array::value ); - using arrayType0 = LvArray::Array; + using arrayType0 = LvArray::Array::type,int>; EXPECT_FALSE( is_packable_array::value ); EXPECT_FALSE( is_packable_array::value ); @@ -118,7 +118,7 @@ TEST(testGeosxTraits,test_is_packable_map) using mapType1 = map >; EXPECT_FALSE( is_packable_map< mapType1 >::value ); - using arrayType = LvArray::Array; + using arrayType = LvArray::Array::type,int>; using mapType2 = map; EXPECT_TRUE( is_packable_map< mapType2 >::value ); diff --git a/src/coreComponents/common/DataTypes.hpp b/src/coreComponents/common/DataTypes.hpp index 34774cb33c4..d765e55d7ba 100644 --- a/src/coreComponents/common/DataTypes.hpp +++ b/src/coreComponents/common/DataTypes.hpp @@ -21,19 +21,7 @@ #ifndef GEOSX_COMMON_DATATYPES_HPP #define GEOSX_COMMON_DATATYPES_HPP -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - +// Source includes #include "common/GeosxConfig.hpp" #include "Macros.hpp" #include "Logger.hpp" @@ -44,14 +32,29 @@ #include "ArrayOfSets.hpp" #include "math/TensorT/TensorT.h" +// TPL includes +#include + #ifdef GEOSX_USE_ATK -#include "axom/sidre/core/SidreTypes.hpp" + #include #endif +// System includes #ifdef GEOSX_USE_MPI -#include + #include #endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /** * top level geosx namespace contains all code that is specific to GEOSX @@ -66,13 +69,7 @@ extern MPI_Comm MPI_COMM_GEOSX; constexpr int MPI_COMM_GEOSX = 0; #endif -// underlying types not for general use!! -//using int32 = std::int32_t; -//using int64 = std::int64_t; -//using uint32 = std::uint32_t; -//using uint64 = std::uint64_t; -/// alias for std::size_t using size_t = std::size_t; using integer = std::int32_t; using localIndex = std::ptrdiff_t; @@ -81,8 +78,6 @@ using string = std::string; using real32 = float; using real64 = double; -//using real = double; - template< typename T > using ptr = T*; @@ -109,86 +104,74 @@ using buffer_type = std::vector< buffer_unit_type >; //***** BEGIN ARRAY TYPEDEFS ***** -template< typename T, int NDIM=1 > -using array_view = LvArray::ArrayView< T, NDIM, localIndex >; +template< typename T, int NDIM, typename PERMUTATION=camp::make_idx_seq_t< NDIM > > +using array_decl = LvArray::Array< T, NDIM, PERMUTATION, localIndex >; -template< typename T, int NDIM=1 > -using array_slice = LvArray::ArraySlice< T, NDIM, localIndex >; +template< typename T, int NDIM, int UNIT_STRIDE_DIM = NDIM - 1 > +using array_view = LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, localIndex >; -template< typename T, int NDIM, int MAXSIZE > -using stack_array = LvArray::Array< T, NDIM, localIndex, LvArray::StackArrayWrapper< T, MAXSIZE > >; +template< typename T, int NDIM, int UNIT_STRIDE_DIM = NDIM - 1 > +using array_slice = LvArray::ArraySlice< T, NDIM, UNIT_STRIDE_DIM, localIndex >; -template< typename T > -using array1d = LvArray::Array< T, 1, localIndex >; +template< typename T, int NDIM, int MAXSIZE, typename PERMUTATION=camp::make_idx_seq_t< NDIM > > +using stack_array = LvArray::Array< T, NDIM, PERMUTATION, localIndex, LvArray::StackArrayWrapper< T, MAXSIZE > >; template< typename T > -using arrayView1d = array_view< T, 1 >; +using array1d = array_decl< T, 1 >; template< typename T > -using arraySlice1d = LvArray::ArraySlice1d< T, localIndex >; +using arrayView1d = array_view< T, 1 >; -template< typename T > -using arraySlice1dRval = LvArray::ArraySlice1d_rval< T, localIndex >; +template< typename T, int UNIT_STRIDE_DIM = 0 > +using arraySlice1d = array_slice< T, 1, UNIT_STRIDE_DIM >; template< typename T, int MAXSIZE > using stackArray1d = stack_array< T, 1, MAXSIZE >; -template< typename T > -using array2d = LvArray::Array< T, 2, localIndex >; +template< typename T, typename PERMUTATION=camp::make_idx_seq_t< 2 > > +using array2d = array_decl< T, 2, PERMUTATION >; -template< typename T > -using arrayView2d = array_view< T, 2 >; +template< typename T, int UNIT_STRIDE_DIM = 1 > +using arrayView2d = array_view< T, 2, UNIT_STRIDE_DIM >; -template< typename T > -using arraySlice2d = LvArray::ArraySlice< T, 2, localIndex >; +template< typename T, int UNIT_STRIDE_DIM = 1 > +using arraySlice2d = array_slice< T, 2, UNIT_STRIDE_DIM >; template< typename T, int MAXSIZE > using stackArray2d = stack_array< T, 2, MAXSIZE >; -template< typename T, bool CONST_SIZES=std::is_const< T >::value > -using ArrayOfArraysView = LvArray::ArrayOfArraysView< T, localIndex const, CONST_SIZES >; - -template< typename T > -using ArrayOfArrays = LvArray::ArrayOfArrays< T, localIndex >; - -template< typename T > -using ArrayOfSetsView = LvArray::ArrayOfSetsView< T, localIndex const >; - -template< typename T > -using ArrayOfSets = LvArray::ArrayOfSets< T, localIndex >; - template< typename T > -using array3d = LvArray::Array< T, 3, localIndex >; +using array3d = array_decl< T, 3 >; template< typename T > using arrayView3d = array_view< T, 3 >; template< typename T > -using arraySlice3d = LvArray::ArraySlice< T, 3, localIndex >; +using arraySlice3d = array_slice< T, 3 >; template< typename T, int MAXSIZE > using stackArray3d = stack_array< T, 3, MAXSIZE >; template< typename T > -using array4d = LvArray::Array< T, 4, localIndex >; +using array4d = array_decl< T, 4 >; template< typename T > -using arrayView4d = LvArray::ArrayView< T, 4, localIndex >; +using arrayView4d = array_view< T, 4 >; template< typename T > -using arraySlice4d = LvArray::ArrayView< T, 4, localIndex >; +using arraySlice4d = array_slice< T, 4 >; template< typename T, int MAXSIZE > using stackArray4d = stack_array< T, 4, MAXSIZE >; template< typename T > -using array5d = LvArray::Array< T, 5, localIndex >; +using array5d = array_decl< T, 5 >; template< typename T > -using arrayView5d = LvArray::ArrayView< T, 5, localIndex >; +using arrayView5d = array_view< T, 5 >; template< typename T > -using arraySlice5d = LvArray::ArrayView< T, 5, localIndex >; +using arraySlice5d = array_slice< T, 5 >; template< typename T, int MAXSIZE > using stackArray5d = stack_array< T, 5, MAXSIZE >; @@ -202,6 +185,18 @@ using SortedArray = LvArray::SortedArray< T, localIndex >; template< typename T > using SortedArrayView = LvArray::SortedArrayView< T, localIndex >; +template< typename T, bool CONST_SIZES=std::is_const< T >::value > +using ArrayOfArraysView = LvArray::ArrayOfArraysView< T, localIndex const, CONST_SIZES >; + +template< typename T > +using ArrayOfArrays = LvArray::ArrayOfArrays< T, localIndex >; + +template< typename T > +using ArrayOfSetsView = LvArray::ArrayOfSetsView< T, localIndex const >; + +template< typename T > +using ArrayOfSets = LvArray::ArrayOfSets< T, localIndex >; + template< typename TKEY, typename TVAL, typename SORTED > class mapBase {}; diff --git a/src/coreComponents/common/unitTests/CMakeLists.txt b/src/coreComponents/common/unitTests/CMakeLists.txt index 86ea946147b..f90ddaf5ff8 100644 --- a/src/coreComponents/common/unitTests/CMakeLists.txt +++ b/src/coreComponents/common/unitTests/CMakeLists.txt @@ -14,7 +14,6 @@ set( dependencyList gtest common ) # foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) - message("processing test_name ${test_name}") blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} diff --git a/src/coreComponents/constitutive/unitTests/CMakeLists.txt b/src/coreComponents/constitutive/unitTests/CMakeLists.txt index 156526c97f6..5959e6dd56d 100644 --- a/src/coreComponents/constitutive/unitTests/CMakeLists.txt +++ b/src/coreComponents/constitutive/unitTests/CMakeLists.txt @@ -33,7 +33,6 @@ endif() # foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) - message("processing test_name ${test_name}") blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} diff --git a/src/coreComponents/constitutive/unitTests/testCapillaryPressure.cpp b/src/coreComponents/constitutive/unitTests/testCapillaryPressure.cpp index 987a444996b..d5ae5113ce8 100644 --- a/src/coreComponents/constitutive/unitTests/testCapillaryPressure.cpp +++ b/src/coreComponents/constitutive/unitTests/testCapillaryPressure.cpp @@ -12,130 +12,23 @@ * ------------------------------------------------------------------------------------------------------------ */ -#include "gtest/gtest.h" - +// Source inclues #include "SetSignalHandling.hpp" #include "stackTrace.hpp" #include "common/DataTypes.hpp" #include "common/TimingMacros.hpp" #include "constitutive/CapillaryPressure/BrooksCoreyCapillaryPressure.hpp" #include "constitutive/CapillaryPressure/VanGenuchtenCapillaryPressure.hpp" +#include "physicsSolvers/unitTests/testCompFlowUtils.hpp" + +// TPL includes +#include using namespace geosx; +using namespace geosx::testing; using namespace geosx::constitutive; using namespace geosx::dataRepository; -template -using Array = LvArray::Array; - -template -::testing::AssertionResult checkRelativeErrorFormat( const char *, const char *, const char *, - T v1, T v2, T relTol ) -{ - T const delta = std::abs( v1 - v2 ); - T const value = std::max( std::abs(v1), std::abs(v2) ); - if (delta > relTol * value) - { - return ::testing::AssertionFailure() << std::scientific << std::setprecision(5) - << " relative error: " << delta / value - << " (" << v1 << " vs " << v2 << ")," - << " exceeds " << relTol << std::endl; - } - return ::testing::AssertionSuccess(); -} - -template -void checkRelativeError( T v1, T v2, T relTol ) -{ - EXPECT_PRED_FORMAT3( checkRelativeErrorFormat, v1, v2, relTol ); -} - -template -void checkRelativeError( T v1, T v2, T relTol, string const & name ) -{ - SCOPED_TRACE(name); - EXPECT_PRED_FORMAT3( checkRelativeErrorFormat, v1, v2, relTol ); -} - -template -void checkDerivative( T valueEps, T value, T deriv, real64 eps, real64 relTol, string const & name, string const & var ) -{ - T numDeriv = (valueEps - value) / eps; - checkRelativeError( deriv, numDeriv, relTol, "d(" + name + ")/d(" + var + ")" ); -} - -template -void -checkDerivative( arraySlice1d const & valueEps, - arraySlice1d const & value, - arraySlice1d const & deriv, - real64 eps, real64 relTol, - string const & name, string const & var, - string_array const & labels, - Args ... label_lists ) -{ - localIndex const size = labels.size(0); - - for (localIndex i = 0; i < size; ++i) - { - checkDerivative( valueEps[i], value[i], deriv[i], eps, relTol, - name + "[" + labels[i] + "]", var, label_lists... ); - } -} - -template -typename std::enable_if<(DIM > 1), void>::type -checkDerivative( array_slice const & valueEps, - array_slice const & value, - array_slice const & deriv, - real64 eps, real64 relTol, - string const & name, string const & var, - string_array const & labels, - Args ... label_lists ) -{ - localIndex const size = labels.size(0); - - for (localIndex i = 0; i < size; ++i) - { - checkDerivative( valueEps[i], value[i], deriv[i], eps, relTol, - name + "[" + labels[i] + "]", var, label_lists... ); - } -} - -// invert compositional derivative array layout to move innermost slice on the top -// (this is needed so we can use checkDerivative() to check derivative w.r.t. for each compositional var) -array1d invertLayout( arraySlice1d const & input, localIndex N ) -{ - Array output( N ); - for (int i = 0; i < N; ++i) - output[i] = input[i]; - - return output; -} - -array2d invertLayout( arraySlice2d const & input, localIndex N1, localIndex N2 ) -{ - Array output( N2, N1 ); - - for (int i = 0; i < N1; ++i) - for (int j = 0; j < N2; ++j) - output[j][i] = input[i][j]; - - return output; -} - -array3d invertLayout( arraySlice3d const & input, localIndex N1, localIndex N2, localIndex N3 ) -{ - Array output( N3, N1, N2 ); - - for (int i = 0; i < N1; ++i) - for (int j = 0; j < N2; ++j) - for (int k = 0; k < N3; ++k) - output[k][i][j] = input[i][j][k]; - - return output; -} - void testNumericalDerivatives( CapillaryPressureBase * capPressure, arraySlice1d const & saturation, real64 perturbParameter, @@ -177,7 +70,14 @@ void testNumericalDerivatives( CapillaryPressureBase * capPressure, capPressureCopy->PointUpdate( satNew, 0, 0 ); string var = "phaseVolFrac[" + phases[jp] + "]"; - checkDerivative( phaseCapPressureCopy, phaseCapPressure, dPhaseCapPressure_dS[jp], dS, relTol, "phaseCapPressure", var, phases ); + checkDerivative( phaseCapPressureCopy.toSliceConst(), + phaseCapPressure.toSliceConst(), + dPhaseCapPressure_dS[jp].toSliceConst(), + dS, + relTol, + "phaseCapPressure", + var, + phases ); } } diff --git a/src/coreComponents/constitutive/unitTests/testMultiFluid.cpp b/src/coreComponents/constitutive/unitTests/testMultiFluid.cpp index 80b524f2196..00c765b0f5c 100644 --- a/src/coreComponents/constitutive/unitTests/testMultiFluid.cpp +++ b/src/coreComponents/constitutive/unitTests/testMultiFluid.cpp @@ -12,22 +12,23 @@ * ------------------------------------------------------------------------------------------------------------ */ -#include "gtest/gtest.h" - +// Source includes #include "SetSignalHandling.hpp" #include "stackTrace.hpp" #include "common/DataTypes.hpp" #include "common/TimingMacros.hpp" #include "constitutive/Fluid/CompositionalMultiphaseFluid.hpp" #include "constitutive/Fluid/BlackOilFluid.hpp" +#include "physicsSolvers/unitTests/testCompFlowUtils.hpp" + +// TPL includes +#include using namespace geosx; +using namespace geosx::testing; using namespace geosx::constitutive; using namespace geosx::dataRepository; -template -using Array = LvArray::Array; - /// Black-oil tables written into temporary files during testing static const char * pvtg_str = "#\tPg(Pa)\t\tRv(sm3/sm3)\tBg(m3/sm3)\tVisc(Pa.s)\n" @@ -108,115 +109,6 @@ static const char * pvdo_str = "#P[Pa]\tBo[m3/sm3]\tVisc(Pa.s)\n" static const char * pvdw_str = "#\tPref[bar]\tBw[m3/sm3]\tCp[1/bar]\t Visc[cP]\n" "\t30600000.1\t1.03\t\t0.00000000041\t0.0003"; -template -::testing::AssertionResult checkRelativeErrorFormat( const char *, const char *, const char *, const char *, - T v1, T v2, T relTol, T absTol ) -{ - T const delta = std::abs( v1 - v2 ); - T const value = std::max( std::abs(v1), std::abs(v2) ); - if (delta > absTol && delta > relTol * value) - { - return ::testing::AssertionFailure() << std::scientific << std::setprecision(5) - << " relative error: " << delta / value - << " (" << v1 << " vs " << v2 << ")," - << " exceeds " << relTol << std::endl; - } - return ::testing::AssertionSuccess(); -} - -template -void checkRelativeError( T v1, T v2, T relTol, T absTol ) -{ - EXPECT_PRED_FORMAT4( checkRelativeErrorFormat, v1, v2, relTol, absTol ); -} - -template -void checkRelativeError( T v1, T v2, T relTol, T absTol, string const & name ) -{ - SCOPED_TRACE(name); - EXPECT_PRED_FORMAT4( checkRelativeErrorFormat, v1, v2, relTol, absTol ); -} - -template -void checkDerivative( T valueEps, T value, T deriv, real64 eps, real64 relTol, T absTol, - string const & name, string const & var ) -{ - T numDeriv = (valueEps - value) / eps; - checkRelativeError( deriv, numDeriv, relTol, absTol, "d(" + name + ")/d(" + var + ")" ); -} - -template -void -checkDerivative( arraySlice1d const & valueEps, - arraySlice1d const & value, - arraySlice1d const & deriv, - real64 eps, real64 relTol, real64 absTol, - string const & name, string const & var, - string_array const & labels, - Args ... label_lists ) -{ - localIndex const size = labels.size(0); - - for (localIndex i = 0; i < size; ++i) - { - checkDerivative( valueEps[i], value[i], deriv[i], eps, relTol, absTol, - name + "[" + labels[i] + "]", var, label_lists... ); - } -} - -template -typename std::enable_if<(DIM > 1), void>::type -checkDerivative( array_slice const & valueEps, - array_slice const & value, - array_slice const & deriv, - real64 eps, real64 relTol, real64 absTol, - string const & name, string const & var, - string_array const & labels, - Args ... label_lists ) -{ - localIndex const size = labels.size(0); - - for (localIndex i = 0; i < size; ++i) - { - checkDerivative( valueEps[i], value[i], deriv[i], eps, relTol, absTol, - name + "[" + labels[i] + "]", var, label_lists... ); - } -} - -// invert compositional derivative array layout to move innermost slice on the top -// (this is needed so we can use checkDerivative() to check derivative w.r.t. for each compositional var) -array1d invertLayout( arraySlice1d const & input, localIndex N ) -{ - Array output( N ); - for (int i = 0; i < N; ++i) - output[i] = input[i]; - - return output; -} - -array2d invertLayout( arraySlice2d const & input, localIndex N1, localIndex N2 ) -{ - Array output( N2, N1 ); - - for (int i = 0; i < N1; ++i) - for (int j = 0; j < N2; ++j) - output[j][i] = input[i][j]; - - return output; -} - -array3d invertLayout( arraySlice3d const & input, localIndex N1, localIndex N2, localIndex N3 ) -{ - Array output( N3, N1, N2 ); - - for (int i = 0; i < N1; ++i) - for (int j = 0; j < N2; ++j) - for (int k = 0; k < N3; ++k) - output[k][i][j] = input[i][j][k]; - - return output; -} - void testNumericalDerivatives( MultiFluidBase * fluid, real64 P, real64 T, @@ -241,7 +133,7 @@ void testNumericalDerivatives( MultiFluidBase * fluid, // extract data views from both fluids #define GET_FLUID_DATA( FLUID, DIM, KEY ) \ - FLUID->getReference>( MultiFluidBase::viewKeyStruct::KEY )[0][0] + FLUID->getReference>( MultiFluidBase::viewKeyStruct::KEY )[0][0] CompositionalVarContainer<1> phaseFrac { GET_FLUID_DATA( fluid, 3, phaseFractionString ), @@ -298,8 +190,16 @@ void testNumericalDerivatives( MultiFluidBase * fluid, checkDerivative( phaseDensCopy, phaseDens.value, phaseDens.dPres, dP, relTol, absTol, "phaseDens", "Pres", phases ); checkDerivative( phaseViscCopy, phaseVisc.value, phaseVisc.dPres, dP, relTol, absTol, "phaseVisc", "Pres", phases ); checkDerivative( totalDensCopy, totalDens.value, totalDens.dPres, dP, relTol, absTol, "totalDens", "Pres" ); - checkDerivative( phaseCompFracCopy, phaseCompFrac.value, phaseCompFrac.dPres, dP, relTol, absTol, - "phaseCompFrac", "Pres", phases, components ); + checkDerivative( phaseCompFracCopy.toSliceConst(), + phaseCompFrac.value.toSliceConst(), + phaseCompFrac.dPres.toSliceConst(), + dP, + relTol, + absTol, + "phaseCompFrac", + "Pres", + phases, + components ); } // update temperature and check derivatives @@ -311,8 +211,16 @@ void testNumericalDerivatives( MultiFluidBase * fluid, checkDerivative( phaseDensCopy, phaseDens.value, phaseDens.dTemp, dT, relTol, absTol, "phaseDens", "Temp", phases ); checkDerivative( phaseViscCopy, phaseVisc.value, phaseVisc.dTemp, dT, relTol, absTol, "phaseVisc", "Temp", phases ); checkDerivative( totalDensCopy, totalDens.value, totalDens.dTemp, dT, relTol, absTol, "totalDens", "Temp" ); - checkDerivative( phaseCompFracCopy, phaseCompFrac.value, phaseCompFrac.dTemp, dT, relTol, absTol, - "phaseCompFrac", "Temp", phases, components ); + checkDerivative( phaseCompFracCopy.toSliceConst(), + phaseCompFrac.value.toSliceConst(), + phaseCompFrac.dTemp.toSliceConst(), + dT, + relTol, + absTol, + "phaseCompFrac", + "Temp", + phases, + components ); } // update composition and check derivatives @@ -346,7 +254,7 @@ void testNumericalDerivatives( MultiFluidBase * fluid, checkDerivative( phaseDensCopy, phaseDens.value, dPhaseDens_dC[jc], dC, relTol, absTol, "phaseDens", var, phases ); checkDerivative( phaseViscCopy, phaseVisc.value, dPhaseVisc_dC[jc], dC, relTol, absTol, "phaseVisc", var, phases ); checkDerivative( totalDensCopy, totalDens.value, dTotalDens_dC[jc], dC, relTol, absTol, "totalDens", var ); - checkDerivative( phaseCompFracCopy, phaseCompFrac.value, dPhaseCompFrac_dC[jc], dC, relTol, absTol, + checkDerivative( phaseCompFracCopy.toSliceConst(), phaseCompFrac.value.toSliceConst(), dPhaseCompFrac_dC[jc].toSliceConst(), dC, relTol, absTol, "phaseCompFrac", var, phases, components ); } } diff --git a/src/coreComponents/constitutive/unitTests/testRelPerm.cpp b/src/coreComponents/constitutive/unitTests/testRelPerm.cpp index 41865726f7c..7ded2843c9f 100644 --- a/src/coreComponents/constitutive/unitTests/testRelPerm.cpp +++ b/src/coreComponents/constitutive/unitTests/testRelPerm.cpp @@ -12,8 +12,7 @@ * ------------------------------------------------------------------------------------------------------------ */ -#include "gtest/gtest.h" - +// Source includes #include "SetSignalHandling.hpp" #include "stackTrace.hpp" #include "common/DataTypes.hpp" @@ -21,122 +20,16 @@ #include "constitutive/RelPerm/BrooksCoreyRelativePermeability.hpp" #include "constitutive/RelPerm/BrooksCoreyBakerRelativePermeability.hpp" #include "constitutive/RelPerm/VanGenuchtenBakerRelativePermeability.hpp" +#include "physicsSolvers/unitTests/testCompFlowUtils.hpp" + +// TPL includes +#include using namespace geosx; +using namespace geosx::testing; using namespace geosx::constitutive; using namespace geosx::dataRepository; -template -using Array = LvArray::Array; - -template -::testing::AssertionResult checkRelativeErrorFormat( const char *, const char *, const char *, - T v1, T v2, T relTol ) -{ - T const delta = std::abs( v1 - v2 ); - T const value = std::max( std::abs(v1), std::abs(v2) ); - if (delta > relTol * value) - { - return ::testing::AssertionFailure() << std::scientific << std::setprecision(5) - << " relative error: " << delta / value - << " (" << v1 << " vs " << v2 << ")," - << " exceeds " << relTol << std::endl; - } - return ::testing::AssertionSuccess(); -} - -template -void checkRelativeError( T v1, T v2, T relTol ) -{ - EXPECT_PRED_FORMAT3( checkRelativeErrorFormat, v1, v2, relTol ); -} - -template -void checkRelativeError( T v1, T v2, T relTol, string const & name ) -{ - SCOPED_TRACE(name); - EXPECT_PRED_FORMAT3( checkRelativeErrorFormat, v1, v2, relTol ); -} - -template -void checkDerivative( T valueEps, T value, T deriv, real64 eps, real64 relTol, string const & name, string const & var ) -{ - T numDeriv = (valueEps - value) / eps; - checkRelativeError( deriv, numDeriv, relTol, "d(" + name + ")/d(" + var + ")" ); -} - -template -void -checkDerivative( arraySlice1d const & valueEps, - arraySlice1d const & value, - arraySlice1d const & deriv, - real64 eps, real64 relTol, - string const & name, string const & var, - string_array const & labels, - Args ... label_lists ) -{ - localIndex const size = labels.size(0); - - for (localIndex i = 0; i < size; ++i) - { - checkDerivative( valueEps[i], value[i], deriv[i], eps, relTol, - name + "[" + labels[i] + "]", var, label_lists... ); - } -} - -template -typename std::enable_if<(DIM > 1), void>::type -checkDerivative( array_slice const & valueEps, - array_slice const & value, - array_slice const & deriv, - real64 eps, real64 relTol, - string const & name, string const & var, - string_array const & labels, - Args ... label_lists ) -{ - localIndex const size = labels.size(0); - - for (localIndex i = 0; i < size; ++i) - { - checkDerivative( valueEps[i], value[i], deriv[i], eps, relTol, - name + "[" + labels[i] + "]", var, label_lists... ); - } -} - -// invert compositional derivative array layout to move innermost slice on the top -// (this is needed so we can use checkDerivative() to check derivative w.r.t. for each compositional var) -array1d invertLayout( arraySlice1d const & input, localIndex N ) -{ - Array output( N ); - for (int i = 0; i < N; ++i) - output[i] = input[i]; - - return output; -} - -array2d invertLayout( arraySlice2d const & input, localIndex N1, localIndex N2 ) -{ - Array output( N2, N1 ); - - for (int i = 0; i < N1; ++i) - for (int j = 0; j < N2; ++j) - output[j][i] = input[i][j]; - - return output; -} - -array3d invertLayout( arraySlice3d const & input, localIndex N1, localIndex N2, localIndex N3 ) -{ - Array output( N3, N1, N2 ); - - for (int i = 0; i < N1; ++i) - for (int j = 0; j < N2; ++j) - for (int k = 0; k < N3; ++k) - output[k][i][j] = input[i][j][k]; - - return output; -} - void testNumericalDerivatives( RelativePermeabilityBase * relPerm, arraySlice1d const & saturation, real64 perturbParameter, @@ -178,7 +71,14 @@ void testNumericalDerivatives( RelativePermeabilityBase * relPerm, relPermCopy->PointUpdate( satNew, 0, 0 ); string var = "phaseVolFrac[" + phases[jp] + "]"; - checkDerivative( phaseRelPermCopy, phaseRelPerm, dPhaseRelPerm_dS[jp], dS, relTol, "phaseRelPerm", var, phases ); + checkDerivative( phaseRelPermCopy.toSliceConst(), + phaseRelPerm.toSliceConst(), + dPhaseRelPerm_dS[jp].toSliceConst(), + dS, + relTol, + "phaseRelPerm", + var, + phases ); } } diff --git a/src/coreComponents/cxx-utilities b/src/coreComponents/cxx-utilities index 2ccde3fa89d..f2e649e8bd1 160000 --- a/src/coreComponents/cxx-utilities +++ b/src/coreComponents/cxx-utilities @@ -1 +1 @@ -Subproject commit 2ccde3fa89dc5264039c00a7f6ec3fe0bae27619 +Subproject commit f2e649e8bd142eb62cc6d6ff944a513dcaec294c diff --git a/src/coreComponents/dataRepository/BufferOps.hpp b/src/coreComponents/dataRepository/BufferOps.hpp index 5249feaf893..74f5a2f695d 100644 --- a/src/coreComponents/dataRepository/BufferOps.hpp +++ b/src/coreComponents/dataRepository/BufferOps.hpp @@ -100,69 +100,65 @@ Unpack( char const * & buffer, INDEX_TYPE const expectedLength ); //------------------------------------------------------------------------------ -template< bool DO_PACKING, typename T, typename INDEX_TYPE > +template< bool DO_PACKING, typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > localIndex Pack( char * & buffer, T const * const restrict var, - arraySlice1d< INDEX_TYPE const > const & indices, + arraySlice1d< INDEX_TYPE const, UNIT_STRIDE_DIM > const & indices, INDEX_TYPE const length ); //------------------------------------------------------------------------------ -template< typename T, typename INDEX_TYPE > +template< typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > localIndex Unpack( char const * & buffer, T * const restrict var, - arraySlice1d< INDEX_TYPE const > const & indices, + arraySlice1d< INDEX_TYPE const, UNIT_STRIDE_DIM > const & indices, INDEX_TYPE & length ); -#ifdef GEOSX_USE_ARRAY_BOUNDS_CHECK - //------------------------------------------------------------------------------ -template< bool DO_PACKING, typename T, typename INDEX_TYPE > +template< bool DO_PACKING, typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type Pack( char * & buffer, - arraySlice1d< T > const & var, + arraySlice1d< T const, UNIT_STRIDE_DIM > const & var, INDEX_TYPE const length ); //------------------------------------------------------------------------------ -template< bool DO_PACKING, typename T, typename INDEX_TYPE > +template< bool DO_PACKING, typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > typename std::enable_if< !std::is_trivial< T >::value, localIndex >::type Pack( char * & buffer, - arraySlice1d< T > const & var, + arraySlice1d< T const, UNIT_STRIDE_DIM > const & var, INDEX_TYPE const length ); //------------------------------------------------------------------------------ -template< typename T, typename INDEX_TYPE > +template< typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type Unpack( char const * & buffer, - arraySlice1d< T > & var, + arraySlice1d< T, UNIT_STRIDE_DIM > const & var, INDEX_TYPE const expectedLength ); //------------------------------------------------------------------------------ -template< typename T, typename INDEX_TYPE > +template< typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > typename std::enable_if< !std::is_trivial< T >::value, localIndex >::type Unpack( char const * & buffer, - arraySlice1d< T > & var, + arraySlice1d< T, UNIT_STRIDE_DIM > const & var, INDEX_TYPE const expectedLength ); //------------------------------------------------------------------------------ -template< bool DO_PACKING, typename T, typename INDEX_TYPE > +template< bool DO_PACKING, typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM0, int UNIT_STRIDE_DIM1 > localIndex Pack( char * & buffer, - arraySlice1d< T > const & var, - arraySlice1d< INDEX_TYPE > const & indices, + arraySlice1d< T const, UNIT_STRIDE_DIM0 > const & var, + arraySlice1d< INDEX_TYPE const, UNIT_STRIDE_DIM1 > const & indices, INDEX_TYPE const length ); //------------------------------------------------------------------------------ -template< typename T, typename INDEX_TYPE > +template< typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM0, int UNIT_STRIDE_DIM1 > localIndex Unpack( char const * & buffer, - arraySlice1d< T > & var, - arraySlice1d< INDEX_TYPE > const & indices, + arraySlice1d< T, UNIT_STRIDE_DIM0 > const & var, + arraySlice1d< INDEX_TYPE const, UNIT_STRIDE_DIM1 > const & indices, INDEX_TYPE & length ); -#endif /* GEOSX_USE_ARRAY_BOUNDS_CHECK */ - //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T > @@ -175,12 +171,12 @@ localIndex Unpack( char const * & buffer, set< T > & var ); //------------------------------------------------------------------------------ -template< bool DO_PACKING > +template< bool DO_PACKING, int UNIT_STRIDE_DIM > localIndex Pack( char * & buffer, set< localIndex > const & var, set< globalIndex > const & unmappedGlobalIndices, - arraySlice1d< globalIndex const > const & localToGlobal ); + arraySlice1d< globalIndex const, UNIT_STRIDE_DIM > const & localToGlobal ); //------------------------------------------------------------------------------ template< typename SORTED > @@ -193,28 +189,28 @@ Unpack( char const * & buffer, bool const clearExistingSet ); //------------------------------------------------------------------------------ -template< bool DO_PACKING, typename T, int NDIM, typename INDEX_TYPE > -typename std::enable_if< bufferOps::is_packable_array< LvArray::ArrayView< T, NDIM, INDEX_TYPE > >::value, localIndex >::type +template< bool DO_PACKING, typename T, int NDIM, int UNIT_STRIDE_DIM, typename INDEX_TYPE > +typename std::enable_if< bufferOps::is_packable_array< LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > >::value, localIndex >::type Pack( char * & buffer, - LvArray::ArrayView< T, NDIM, INDEX_TYPE > const & var ); + LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > const & var ); //------------------------------------------------------------------------------ -template< typename T, int NDIM, typename INDEX_TYPE > -typename std::enable_if< bufferOps::is_packable_array< LvArray::Array< T, NDIM, INDEX_TYPE > >::value, localIndex >::type -Unpack( char const * & buffer, LvArray::Array< T, NDIM, INDEX_TYPE > & var ); +template< typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE > +typename std::enable_if< bufferOps::is_packable_array< LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > >::value, localIndex >::type +Unpack( char const * & buffer, LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > & var ); //------------------------------------------------------------------------------ -template< bool DO_PACKING, typename T, int NDIM, typename T_indices, typename INDEX_TYPE > -typename std::enable_if< bufferOps::is_packable_array< LvArray::ArrayView< T, NDIM, INDEX_TYPE > >::value, localIndex >::type +template< bool DO_PACKING, typename T, int NDIM, int UNIT_STRIDE_DIM, typename T_indices, typename INDEX_TYPE > +typename std::enable_if< bufferOps::is_packable_array< LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > >::value, localIndex >::type Pack( char * & buffer, - LvArray::ArrayView< T, NDIM, INDEX_TYPE > const & var, + LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > const & var, const T_indices & indices ); //------------------------------------------------------------------------------ -template< typename T, int NDIM, typename T_indices, typename INDEX_TYPE > +template< typename T, int NDIM, int UNIT_STRIDE_DIM, typename T_indices, typename INDEX_TYPE > localIndex Unpack( char const * & buffer, - LvArray::ArrayView< T, NDIM, INDEX_TYPE > & var, + LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > & var, const T_indices & indices ); @@ -253,10 +249,10 @@ Unpack( char const * & buffer, T_indices const & indices ); //------------------------------------------------------------------------------ -template< bool DO_PACKING > +template< bool DO_PACKING, int UNIT_STRIDE_DIM > localIndex Pack( char * & buffer, - arraySlice1d< localIndex const > const & var, + arraySlice1d< localIndex const, UNIT_STRIDE_DIM > const & var, globalIndex const * const unmappedGlobalIndices, localIndex const length, arraySlice1d< globalIndex const > const & localToGlobalMap ); @@ -271,11 +267,11 @@ Unpack( char const * & buffer, mapBase< globalIndex, localIndex, SORTED > const & globalToLocalMap ); //------------------------------------------------------------------------------ -template< typename SORTED > +template< typename SORTED, int UNIT_STRIDE_DIM > inline localIndex Unpack( char const * & buffer, - arraySlice1d< localIndex > & var, + arraySlice1d< localIndex, UNIT_STRIDE_DIM > const & var, array1d< globalIndex > & unmappedGlobalIndices, localIndex const expectedLength, mapBase< globalIndex, localIndex, SORTED > const & globalToLocalMap ); @@ -344,38 +340,38 @@ Unpack( char const * & buffer, bool const clearFlag ); //------------------------------------------------------------------------------ -template< bool DO_PACKING > +template< bool DO_PACKING, int UNIT_STRIDE_DIM0, int UNIT_STRIDE_DIM1 > localIndex Pack( char * & buffer, - arrayView2d< localIndex > const & var, + arrayView2d< localIndex const, UNIT_STRIDE_DIM0 > const & var, arrayView1d< localIndex > const & indices, - arraySlice1d< globalIndex > const & localToGlobalMap ); + arraySlice1d< globalIndex const, UNIT_STRIDE_DIM1 > const & localToGlobalMap ); //------------------------------------------------------------------------------ -template< typename SORTED > +template< typename SORTED, int UNIT_STRIDE_DIM > inline localIndex Unpack( char const * & buffer, - arrayView2d< localIndex > & var, + arrayView2d< localIndex, UNIT_STRIDE_DIM > const & var, array1d< localIndex > & indices, mapBase< globalIndex, localIndex, SORTED > const & globalToLocalMap ); //------------------------------------------------------------------------------ -template< bool DO_PACKING, typename SORTED > +template< bool DO_PACKING, typename SORTED, int UNIT_STRIDE_DIM0 > localIndex Pack( char * & buffer, - arrayView2d< localIndex const > const & var, + arrayView2d< localIndex const, UNIT_STRIDE_DIM0 > const & var, mapBase< localIndex, array1d< globalIndex >, SORTED > const & unmappedGlobalIndices, arrayView1d< localIndex const > const & indices, arraySlice1d< globalIndex const > const & localToGlobalMap, arraySlice1d< globalIndex const > const & relatedObjectLocalToGlobalMap ); //------------------------------------------------------------------------------ -template< typename SORTED0, typename SORTED1, typename SORTED2 > +template< typename SORTED0, typename SORTED1, typename SORTED2, int UNIT_STRIDE_DIM > inline localIndex Unpack( char const * & buffer, - arrayView2d< localIndex > & var, + arrayView2d< localIndex, UNIT_STRIDE_DIM > const & var, localIndex_array & indices, mapBase< localIndex, array1d< globalIndex >, SORTED0 > & unmappedGlobalIndices, mapBase< globalIndex, localIndex, SORTED1 > const & globalToLocalMap, diff --git a/src/coreComponents/dataRepository/BufferOps_inline.hpp b/src/coreComponents/dataRepository/BufferOps_inline.hpp index 97c4d3b4732..cbc9ce785f3 100644 --- a/src/coreComponents/dataRepository/BufferOps_inline.hpp +++ b/src/coreComponents/dataRepository/BufferOps_inline.hpp @@ -189,11 +189,11 @@ Unpack( char const * & buffer, T * const restrict var, INDEX_TYPE const expected } -template< bool DO_PACKING, typename T, typename INDEX_TYPE > +template< bool DO_PACKING, typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > localIndex Pack( char * & buffer, T const * const restrict var, - arraySlice1d< INDEX_TYPE const > const & indices, + arraySlice1d< INDEX_TYPE const, UNIT_STRIDE_DIM > const & indices, INDEX_TYPE const length ) { localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, length ); @@ -224,13 +224,11 @@ Unpack( char const * & buffer, return sizeOfUnpackedChars; } -#ifdef GEOSX_USE_ARRAY_BOUNDS_CHECK - template< bool DO_PACKING, typename T, typename INDEX_TYPE > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type Pack( char * & buffer, - arraySlice1d< T > const & var, + arraySlice1d< T const > const & var, INDEX_TYPE const length ) { localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, length ); @@ -252,10 +250,10 @@ Pack( char * & buffer, } -template< bool DO_PACKING, typename T, typename INDEX_TYPE > +template< bool DO_PACKING, typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > typename std::enable_if< !std::is_trivial< T >::value, localIndex >::type Pack( char * & buffer, - arraySlice1d< T > const & var, + arraySlice1d< T const, UNIT_STRIDE_DIM > const & var, INDEX_TYPE const length ) { localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, length ); @@ -269,15 +267,16 @@ Pack( char * & buffer, } -template< typename T, typename INDEX_TYPE > +template< typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type Unpack( char const * & buffer, - arraySlice1d< T > & var, + arraySlice1d< T, UNIT_STRIDE_DIM > const & var, INDEX_TYPE const expectedLength ) { INDEX_TYPE length; localIndex sizeOfUnpackedChars = Unpack( buffer, length ); + GEOSX_DEBUG_VAR( expectedLength ); GEOS_ASSERT_MSG( length == expectedLength, "expectedLength != length: " << expectedLength << " != " << length ); @@ -294,15 +293,16 @@ Unpack( char const * & buffer, } -template< typename T, typename INDEX_TYPE > +template< typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > typename std::enable_if< !std::is_trivial< T >::value, localIndex >::type Unpack( char const * & buffer, - arraySlice1d< T > & var, + arraySlice1d< T, UNIT_STRIDE_DIM > const & var, INDEX_TYPE const expectedLength ) { INDEX_TYPE length; localIndex sizeOfUnpackedChars = Unpack( buffer, length ); + GEOSX_DEBUG_VAR( expectedLength ); GEOS_ASSERT_MSG( length == expectedLength, "expectedLength != length: " << expectedLength << " != " << length ); @@ -315,11 +315,11 @@ Unpack( char const * & buffer, } -template< bool DO_PACKING, typename T, typename INDEX_TYPE > +template< bool DO_PACKING, typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM0, int UNIT_STRIDE_DIM1 > localIndex Pack( char * & buffer, - arraySlice1d< T > const & var, - arraySlice1d< INDEX_TYPE > const & indices, + arraySlice1d< T const, UNIT_STRIDE_DIM0 > const & var, + arraySlice1d< INDEX_TYPE const, UNIT_STRIDE_DIM1 > const & indices, INDEX_TYPE const length ) { localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, length ); @@ -333,11 +333,11 @@ Pack( char * & buffer, } -template< typename T, typename INDEX_TYPE > +template< typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM0, int UNIT_STRIDE_DIM1 > localIndex Unpack( char const * & buffer, - arraySlice1d< T > & var, - arraySlice1d< INDEX_TYPE > const & indices, + arraySlice1d< T, UNIT_STRIDE_DIM0 > const & var, + arraySlice1d< INDEX_TYPE const, UNIT_STRIDE_DIM1 > const & indices, INDEX_TYPE & length ) { localIndex sizeOfUnpackedChars = 0; @@ -352,8 +352,6 @@ Unpack( char const * & buffer, return sizeOfUnpackedChars; } -#endif /* GEOSX_USE_ARRAY_BOUNDS_CHECK */ - template< bool DO_PACKING, typename T > localIndex Pack( char * & buffer, set< T > const & var ) @@ -388,11 +386,11 @@ localIndex Unpack( char const * & buffer, set< T > & var ) return sizeOfUnpackedChars; } -template< bool DO_PACKING > +template< bool DO_PACKING, int UNIT_STRIDE_DIM > localIndex Pack( char * & buffer, set< localIndex > const & var, set< globalIndex > const & unmappedGlobalIndices, - arraySlice1d< globalIndex const > const & localToGlobal ) + arraySlice1d< globalIndex const, UNIT_STRIDE_DIM > const & localToGlobal ) { const localIndex length = integer_conversion< localIndex >( var.size()+unmappedGlobalIndices.size()); localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, length ); @@ -519,10 +517,10 @@ localIndex Pack( char * & buffer, } -template< bool DO_PACKING, typename T, int NDIM, typename INDEX_TYPE > -typename std::enable_if< bufferOps::is_packable_array< LvArray::ArrayView< T, NDIM, INDEX_TYPE > >::value, localIndex >::type +template< bool DO_PACKING, typename T, int NDIM, int UNIT_STRIDE_DIM, typename INDEX_TYPE > +typename std::enable_if< bufferOps::is_packable_array< LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > >::value, localIndex >::type Pack( char * & buffer, - LvArray::ArrayView< T, NDIM, INDEX_TYPE > const & var ) + LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > const & var ) { localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, var.dims(), NDIM ); sizeOfPackedChars += Pack< DO_PACKING >( buffer, var.strides(), NDIM ); @@ -535,9 +533,9 @@ Pack( char * & buffer, } -template< typename T, int NDIM, typename INDEX_TYPE > -typename std::enable_if< bufferOps::is_packable_array< LvArray::Array< T, NDIM, INDEX_TYPE > >::value, localIndex >::type -Unpack( char const * & buffer, LvArray::Array< T, NDIM, INDEX_TYPE > & var ) +template< typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE > +typename std::enable_if< bufferOps::is_packable_array< LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > >::value, localIndex >::type +Unpack( char const * & buffer, LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > & var ) { INDEX_TYPE dims[NDIM]; localIndex sizeOfUnpackedChars = Unpack( buffer, dims, NDIM ); @@ -559,10 +557,10 @@ Unpack( char const * & buffer, LvArray::Array< T, NDIM, INDEX_TYPE > & var ) } -template< bool DO_PACKING, typename T, int NDIM, typename T_indices, typename INDEX_TYPE > -typename std::enable_if< bufferOps::is_packable_array< LvArray::ArrayView< T, NDIM, INDEX_TYPE > >::value, localIndex >::type +template< bool DO_PACKING, typename T, int NDIM, int UNIT_STRIDE_DIM, typename T_indices, typename INDEX_TYPE > +typename std::enable_if< bufferOps::is_packable_array< LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > >::value, localIndex >::type Pack( char * & buffer, - LvArray::ArrayView< T, NDIM, INDEX_TYPE > const & var, + LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > const & var, const T_indices & indices ) { localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, var.strides(), NDIM ); @@ -576,10 +574,10 @@ Pack( char * & buffer, } -template< typename T, int NDIM, typename T_indices, typename INDEX_TYPE > +template< typename T, int NDIM, int UNIT_STRIDE_DIM, typename T_indices, typename INDEX_TYPE > localIndex Unpack( char const * & buffer, - LvArray::ArrayView< T, NDIM, INDEX_TYPE > & var, + LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > & var, const T_indices & indices ) { INDEX_TYPE strides[NDIM]; @@ -713,10 +711,10 @@ Unpack( char const * & buffer, } -template< bool DO_PACKING > +template< bool DO_PACKING, int UNIT_STRIDE_DIM > localIndex Pack( char * & buffer, - arraySlice1d< localIndex const > const & var, + arraySlice1d< localIndex const, UNIT_STRIDE_DIM > const & var, globalIndex const * const unmappedGlobalIndices, localIndex const length, arraySlice1d< globalIndex const > const & localToGlobalMap ) @@ -829,11 +827,11 @@ Unpack( char const * & buffer, return sizeOfUnpackedChars; } -template< typename SORTED > +template< typename SORTED, int UNIT_STRIDE_DIM > inline localIndex Unpack( char const * & buffer, - arraySlice1d< localIndex > & var, + arraySlice1d< localIndex, UNIT_STRIDE_DIM > const & var, array1d< globalIndex > & unmappedGlobalIndices, localIndex const expectedLength, mapBase< globalIndex, localIndex, SORTED > const & globalToLocalMap ) @@ -982,8 +980,8 @@ Pack( char * & buffer, iterUnmappedGI->second; sizeOfPackedChars += Pack< DO_PACKING >( buffer, - var[li], - unmappedGI, + var[li].toSliceConst(), + unmappedGI.data(), var[li].size(), relatedObjectLocalToGlobalMap ); } @@ -1306,12 +1304,12 @@ Unpack( char const * & buffer, } -template< bool DO_PACKING > +template< bool DO_PACKING, int UNIT_STRIDE_DIM0, int UNIT_STRIDE_DIM1 > localIndex Pack( char * & buffer, - arrayView2d< localIndex > const & var, + arrayView2d< localIndex const, UNIT_STRIDE_DIM0 > const & var, arrayView1d< localIndex > const & indices, - arraySlice1d< globalIndex > const & localToGlobalMap ) + arraySlice1d< globalIndex const, UNIT_STRIDE_DIM1 > const & localToGlobalMap ) { localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, indices.size() ); for( localIndex a=0 ; a +template< typename SORTED, int UNIT_STRIDE_DIM > inline localIndex Unpack( char const * & buffer, - arrayView2d< localIndex > & var, + arrayView2d< localIndex, UNIT_STRIDE_DIM > const & var, array1d< localIndex > & indices, mapBase< globalIndex, localIndex, SORTED > const & globalToLocalMap ) { @@ -1371,10 +1369,10 @@ Unpack( char const * & buffer, } -template< bool DO_PACKING, typename SORTED > +template< bool DO_PACKING, typename SORTED, int UNIT_STRIDE_DIM0 > localIndex Pack( char * & buffer, - arrayView2d< localIndex const > const & var, + arrayView2d< localIndex const, UNIT_STRIDE_DIM0 > const & var, mapBase< localIndex, array1d< globalIndex >, SORTED > const & unmappedGlobalIndices, arrayView1d< localIndex const > const & indices, arraySlice1d< globalIndex const > const & localToGlobalMap, @@ -1398,7 +1396,7 @@ Pack( char * & buffer, sizeOfPackedChars += Pack< DO_PACKING >( buffer, var[li], - unmappedGI, + unmappedGI.data(), var.size( 1 ), relatedObjectLocalToGlobalMap ); } @@ -1407,11 +1405,11 @@ Pack( char * & buffer, } -template< typename SORTED0, typename SORTED1, typename SORTED2 > +template< typename SORTED0, typename SORTED1, typename SORTED2, int UNIT_STRIDE_DIM > inline localIndex Unpack( char const * & buffer, - arrayView2d< localIndex > & var, + arrayView2d< localIndex, UNIT_STRIDE_DIM > const & var, localIndex_array & indices, mapBase< localIndex, array1d< globalIndex >, SORTED0 > & unmappedGlobalIndices, mapBase< globalIndex, localIndex, SORTED1 > const & globalToLocalMap, @@ -1445,7 +1443,7 @@ Unpack( char const * & buffer, li = globalToLocalMap.at( gi ); } - arraySlice1d< localIndex > varSlice = var[li]; + arraySlice1d< localIndex, UNIT_STRIDE_DIM - 1 > varSlice = var[li]; array1d< globalIndex > unmappedIndices; sizeOfUnpackedChars += Unpack( buffer, diff --git a/src/coreComponents/dataRepository/unitTests/testDefaultValue.cpp b/src/coreComponents/dataRepository/unitTests/testDefaultValue.cpp index ab280d1c902..92b5cfe1967 100644 --- a/src/coreComponents/dataRepository/unitTests/testDefaultValue.cpp +++ b/src/coreComponents/dataRepository/unitTests/testDefaultValue.cpp @@ -23,7 +23,6 @@ #include using namespace geosx; -using namespace LvArray; using namespace dataRepository; @@ -37,12 +36,12 @@ TEST( testDefaultValue, testScalar ) TEST( testDefaultValue, testArray ) { - using array1 = Array< double, 1, int >; - using array2 = Array< double, 2, int >; - using array3 = Array< double, 3, int >; - using array4 = Array< int, 1, int >; - using array5 = Array< long int, 1, long int >; - using array6 = Array< long long int, 1, long long int >; + using array1 = array_decl< double, 1 >; + using array2 = array_decl< double, 2 >; + using array3 = array_decl< double, 3 >; + using array4 = array_decl< int, 1 >; + using array5 = array_decl< long int, 1 >; + using array6 = array_decl< long long int, 1 >; EXPECT_TRUE( DefaultValue< array1 >::has_default_value==true ); EXPECT_TRUE( DefaultValue< array2 >::has_default_value==true ); EXPECT_TRUE( DefaultValue< array3 >::has_default_value==true ); diff --git a/src/coreComponents/dataRepository/unitTests/testSidreExtended.cpp b/src/coreComponents/dataRepository/unitTests/testSidreExtended.cpp index eab07ca45ad..4a8df406d04 100644 --- a/src/coreComponents/dataRepository/unitTests/testSidreExtended.cpp +++ b/src/coreComponents/dataRepository/unitTests/testSidreExtended.cpp @@ -12,7 +12,7 @@ * ------------------------------------------------------------------------------------------------------------ */ - +// Source includes #include "common/DataTypes.hpp" #include "dataRepository/Group.hpp" #include "dataRepository/SidreWrapper.hpp" @@ -22,6 +22,12 @@ #include +// TPL includes +#include + +// System includes +#include + namespace geosx { namespace dataRepository diff --git a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp index 48873480c54..bfe8066e80f 100644 --- a/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp +++ b/src/coreComponents/dataRepository/unitTests/testXmlWrapper.cpp @@ -27,55 +27,55 @@ TEST( testXmlWrapper, array3d_errors ) // This should work { input = " { { {0,1,2},{3,4,5} }, { {6,7,8},{9,10,11} }, { {12,13,14},{15,16,17} } , { {18,19,20},{21,22,23} } }"; - LvArray::Array< int, 3, localIndex > array; + array3d< int > array; xmlWrapper::StringToInputVariable( array, input ); } // This should fail the num('{')==num('}') test { input = " { { {0,1,2},{3,4,5} }, { {6,7,8},{9,10,11} }, { {12,13,14},{15,16,17} } , { {18,19,20},{21,22,23} } "; - LvArray::Array< int, 3, localIndex > array; + array3d< int > array; EXPECT_DEATH_IF_SUPPORTED( xmlWrapper::StringToInputVariable( array, input ), IGNORE_OUTPUT ); } { input = " { { {0,1,2},{3,4,5} }, { {6,7,8},{9,10,11} }, { {12,13,14},{15,16,17} , { {18,19,20},{21,22,23} } }"; - LvArray::Array< int, 3, localIndex > array; + array3d< int > array; EXPECT_DEATH_IF_SUPPORTED( xmlWrapper::StringToInputVariable( array, input ), IGNORE_OUTPUT ); } { input = " { { {0,1,2},{3,4,5} }, { {6,7,8},{9,10,11} }, { {12,13,14,{15,16,17} } , { {18,19,20},{21,22,23} } }"; - LvArray::Array< int, 3, localIndex > array; + array3d< int > array; EXPECT_DEATH_IF_SUPPORTED( xmlWrapper::StringToInputVariable( array, input ), IGNORE_OUTPUT ); } { input = " { { {0,1,2},{3,4,5} }, { {6,7,8,{9,10,11} }, { {12,13,14},{15,16,17} } , { {18,19,20},{21,22,23} } }"; - LvArray::Array< int, 3, localIndex > array; + array3d< int > array; EXPECT_DEATH_IF_SUPPORTED( xmlWrapper::StringToInputVariable( array, input ), IGNORE_OUTPUT ); } { input = " { { 0,1,2},{3,4,5} }, { {6,7,8},{9,10,11} }, { {12,13,14},{15,16,17} } , { {18,19,20},{21,22,23} } }"; - LvArray::Array< int, 3, localIndex > array; + array3d< int > array; EXPECT_DEATH_IF_SUPPORTED( xmlWrapper::StringToInputVariable( array, input ), IGNORE_OUTPUT ); } { input = " { {0,1,2},{3,4,5} }, { {6,7,8},{9,10,11} }, { {12,13,14},{15,16,17} } , { {18,19,20},{21,22,23} } "; - LvArray::Array< int, 3, localIndex > array; + array3d< int > array; EXPECT_DEATH_IF_SUPPORTED( xmlWrapper::StringToInputVariable( array, input ), IGNORE_OUTPUT ); } { input = " { { {,1,2},{3,4,5} }, { {6,7,8},{9,10,11} }, { {12,13,14},{15,16,17} } , { {18,19,20},{21,22,23} } }"; - LvArray::Array< int, 3, localIndex > array; + array3d< int > array; EXPECT_DEATH_IF_SUPPORTED( xmlWrapper::StringToInputVariable( array, input ), IGNORE_OUTPUT ); } { input = " { { {},{3,4,5} }, { {6,7,8},{9,10,11} }, { {12,13,14},{15,16,17} } , { {18,19,20},{21,22,23} } }"; - LvArray::Array< int, 3, localIndex > array; + array3d< int > array; EXPECT_DEATH_IF_SUPPORTED( xmlWrapper::StringToInputVariable( array, input ), IGNORE_OUTPUT ); } { input = " { { {0,1,2}}{ } }"; - LvArray::Array< int, 3, localIndex > array; + array3d< int > array; EXPECT_DEATH_IF_SUPPORTED( xmlWrapper::StringToInputVariable( array, input ), IGNORE_OUTPUT ); } @@ -119,7 +119,7 @@ TEST( testXmlWrapper, array3d ) } input += " }"; - LvArray::Array< int, 3, localIndex > array; + array3d< int > array; xmlWrapper::StringToInputVariable( array, input ); ASSERT_EQ( array.size( 0 ), numI ); diff --git a/src/coreComponents/dataRepository/xmlWrapper.hpp b/src/coreComponents/dataRepository/xmlWrapper.hpp index 8a6e36dd8d3..be0ce803a88 100644 --- a/src/coreComponents/dataRepository/xmlWrapper.hpp +++ b/src/coreComponents/dataRepository/xmlWrapper.hpp @@ -109,7 +109,7 @@ class xmlWrapper static void StringToInputVariable( R1Tensor & target, string value ); template< typename T, int NDIM > - static void StringToInputVariable( LvArray::Array< T, NDIM, localIndex > & array, string value ); + static void StringToInputVariable( array_decl< T, NDIM > & array, string value ); ///@} @@ -171,7 +171,7 @@ void xmlWrapper::StringToInputVariable( T & target, string inputValue ) } template< typename T, int NDIM > -void xmlWrapper::StringToInputVariable( LvArray::Array< T, NDIM, localIndex > & array, string valueString ) +void xmlWrapper::StringToInputVariable( array_decl< T, NDIM > & array, string valueString ) { cxx_utilities::stringToArray( array, valueString ); } diff --git a/src/coreComponents/fileIO/blueprint/Blueprint.cpp b/src/coreComponents/fileIO/blueprint/Blueprint.cpp index 2425543bee3..440943a106a 100644 --- a/src/coreComponents/fileIO/blueprint/Blueprint.cpp +++ b/src/coreComponents/fileIO/blueprint/Blueprint.cpp @@ -173,29 +173,30 @@ void Blueprint::addNodes( Group* coords, Group* fields ) const } -void Blueprint::addCells( Group* topo, Group* GEOSX_UNUSED_ARG( fields ) ) const +void Blueprint::addCells( Group* GEOSX_UNUSED_ARG( topo ), Group* GEOSX_UNUSED_ARG( fields ) ) const { + GEOSX_DEBUG_VAR( m_elem_reg_manager ); #ifdef GEOSX_USE_ATK - if ( m_elem_reg_manager.numCellBlocks() != 1 ) - { - GEOS_ERROR( "Blueprint IO currently only works in problems with one cell block." ); - } + // if ( m_elem_reg_manager.numCellBlocks() != 1 ) + // { + // GEOS_ERROR( "Blueprint IO currently only works in problems with one cell block." ); + // } - const ElementRegionBase* elem_region = m_elem_reg_manager.GetRegion(0); - const CellElementSubRegion* cell_block = elem_region->GetSubRegion(0); - const array2d& connectivity = cell_block->nodeList().Base(); - const localIndex n_cells = connectivity.size(0); - const localIndex n_nodes_per_cell = connectivity.size(1); - const std::string& elem_name = this->numNodesToElemName.at( n_nodes_per_cell ); - - topo->createView( "coordset" )->setString( m_coord_name ); - topo->createView( "type" )->setString( "unstructured" ); - Group* elements_group = topo->createGroup( "elements" ); - elements_group->createView( "shape" )->setString( elem_name ); + // const ElementRegionBase* elem_region = m_elem_reg_manager.GetRegion(0); + // const CellElementSubRegion* cell_block = elem_region->GetSubRegion(0); + // const array2d& connectivity = cell_block->nodeList().Base(); + // const localIndex n_cells = connectivity.size(0); + // const localIndex n_nodes_per_cell = connectivity.size(1); + // const std::string& elem_name = this->numNodesToElemName.at( n_nodes_per_cell ); + + // topo->createView( "coordset" )->setString( m_coord_name ); + // topo->createView( "type" )->setString( "unstructured" ); + // Group* elements_group = topo->createGroup( "elements" ); + // elements_group->createView( "shape" )->setString( elem_name ); - View* connec_view = elements_group->createView( "connectivity" ); - connec_view->setExternalDataPtr( const_cast< localIndex* >( connectivity.data() ) ); - connec_view->apply( detail::SidreTT< localIndex >::id, n_cells * n_nodes_per_cell ); + // View* connec_view = elements_group->createView( "connectivity" ); + // connec_view->setExternalDataPtr( const_cast< localIndex* >( connectivity.data() ) ); + // connec_view->apply( detail::SidreTT< localIndex >::id, n_cells * n_nodes_per_cell ); // for ( const std::pair< const std::string, const WrapperBase* >& pair : cell_block->wrappers() ) // { diff --git a/src/coreComponents/fileIO/schema/docs/BlackOilFluid_other.rst b/src/coreComponents/fileIO/schema/docs/BlackOilFluid_other.rst index 48cc0d27501..348627aa2f4 100644 --- a/src/coreComponents/fileIO/schema/docs/BlackOilFluid_other.rst +++ b/src/coreComponents/fileIO/schema/docs/BlackOilFluid_other.rst @@ -1,28 +1,28 @@ -====================================== ============================================== ========================== -Name Type Description -====================================== ============================================== ========================== -dPhaseCompFraction_dGlobalCompFraction Array< double, 5, long, ChaiVector< double > > (no description available) -dPhaseCompFraction_dPressure Array< double, 4, long, ChaiVector< double > > (no description available) -dPhaseCompFraction_dTemperature Array< double, 4, long, ChaiVector< double > > (no description available) -dPhaseDensity_dGlobalCompFraction Array< double, 4, long, ChaiVector< double > > (no description available) -dPhaseDensity_dPressure real64_array3d (no description available) -dPhaseDensity_dTemperature real64_array3d (no description available) -dPhaseFraction_dGlobalCompFraction Array< double, 4, long, ChaiVector< double > > (no description available) -dPhaseFraction_dPressure real64_array3d (no description available) -dPhaseFraction_dTemperature real64_array3d (no description available) -dPhaseViscosity_dGlobalCompFraction Array< double, 4, long, ChaiVector< double > > (no description available) -dPhaseViscosity_dPressure real64_array3d (no description available) -dPhaseViscosity_dTemperature real64_array3d (no description available) -dTotalDensity_dGlobalCompFraction real64_array3d (no description available) -dTotalDensity_dPressure real64_array2d (no description available) -dTotalDensity_dTemperature real64_array2d (no description available) -phaseCompFraction Array< double, 4, long, ChaiVector< double > > (no description available) -phaseDensity real64_array3d (no description available) -phaseFraction real64_array3d (no description available) -phaseViscosity real64_array3d (no description available) -totalDensity real64_array2d (no description available) -====================================== ============================================== ========================== +====================================== =================================================================================== ========================== +Name Type Description +====================================== =================================================================================== ========================== +dPhaseCompFraction_dGlobalCompFraction Array< double, 5, int_seq< long, 0l, 1l, 2l, 3l, 4l >, long, ChaiVector< double > > (no description available) +dPhaseCompFraction_dPressure Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +dPhaseCompFraction_dTemperature Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +dPhaseDensity_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +dPhaseDensity_dPressure real64_array3d (no description available) +dPhaseDensity_dTemperature real64_array3d (no description available) +dPhaseFraction_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +dPhaseFraction_dPressure real64_array3d (no description available) +dPhaseFraction_dTemperature real64_array3d (no description available) +dPhaseViscosity_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +dPhaseViscosity_dPressure real64_array3d (no description available) +dPhaseViscosity_dTemperature real64_array3d (no description available) +dTotalDensity_dGlobalCompFraction real64_array3d (no description available) +dTotalDensity_dPressure real64_array2d (no description available) +dTotalDensity_dTemperature real64_array2d (no description available) +phaseCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +phaseDensity real64_array3d (no description available) +phaseFraction real64_array3d (no description available) +phaseViscosity real64_array3d (no description available) +totalDensity real64_array2d (no description available) +====================================== =================================================================================== ========================== diff --git a/src/coreComponents/fileIO/schema/docs/BrooksCoreyBakerRelativePermeability_other.rst b/src/coreComponents/fileIO/schema/docs/BrooksCoreyBakerRelativePermeability_other.rst index 292003fab09..1d1eaf9382b 100644 --- a/src/coreComponents/fileIO/schema/docs/BrooksCoreyBakerRelativePermeability_other.rst +++ b/src/coreComponents/fileIO/schema/docs/BrooksCoreyBakerRelativePermeability_other.rst @@ -1,11 +1,11 @@ -=============================== ============================================== ========================== -Name Type Description -=============================== ============================================== ========================== -dPhaseRelPerm_dPhaseVolFraction Array< double, 4, long, ChaiVector< double > > (no description available) -phaseRelPerm real64_array3d (no description available) -phaseTypes integer_array (no description available) -=============================== ============================================== ========================== +=============================== =============================================================================== ========================== +Name Type Description +=============================== =============================================================================== ========================== +dPhaseRelPerm_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +phaseRelPerm real64_array3d (no description available) +phaseTypes integer_array (no description available) +=============================== =============================================================================== ========================== diff --git a/src/coreComponents/fileIO/schema/docs/BrooksCoreyCapillaryPressure_other.rst b/src/coreComponents/fileIO/schema/docs/BrooksCoreyCapillaryPressure_other.rst index 6f980465d9a..1753ccb3bcc 100644 --- a/src/coreComponents/fileIO/schema/docs/BrooksCoreyCapillaryPressure_other.rst +++ b/src/coreComponents/fileIO/schema/docs/BrooksCoreyCapillaryPressure_other.rst @@ -1,12 +1,12 @@ -=================================== ============================================== ========================== -Name Type Description -=================================== ============================================== ========================== -dPhaseCapPressure_dPhaseVolFraction Array< double, 4, long, ChaiVector< double > > (no description available) -phaseCapPressure real64_array3d (no description available) -phaseOrder integer_array (no description available) -phaseTypes integer_array (no description available) -=================================== ============================================== ========================== +=================================== =============================================================================== ========================== +Name Type Description +=================================== =============================================================================== ========================== +dPhaseCapPressure_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +phaseCapPressure real64_array3d (no description available) +phaseOrder integer_array (no description available) +phaseTypes integer_array (no description available) +=================================== =============================================================================== ========================== diff --git a/src/coreComponents/fileIO/schema/docs/BrooksCoreyRelativePermeability_other.rst b/src/coreComponents/fileIO/schema/docs/BrooksCoreyRelativePermeability_other.rst index 292003fab09..1d1eaf9382b 100644 --- a/src/coreComponents/fileIO/schema/docs/BrooksCoreyRelativePermeability_other.rst +++ b/src/coreComponents/fileIO/schema/docs/BrooksCoreyRelativePermeability_other.rst @@ -1,11 +1,11 @@ -=============================== ============================================== ========================== -Name Type Description -=============================== ============================================== ========================== -dPhaseRelPerm_dPhaseVolFraction Array< double, 4, long, ChaiVector< double > > (no description available) -phaseRelPerm real64_array3d (no description available) -phaseTypes integer_array (no description available) -=============================== ============================================== ========================== +=============================== =============================================================================== ========================== +Name Type Description +=============================== =============================================================================== ========================== +dPhaseRelPerm_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +phaseRelPerm real64_array3d (no description available) +phaseTypes integer_array (no description available) +=============================== =============================================================================== ========================== diff --git a/src/coreComponents/fileIO/schema/docs/CompositionalMultiphaseFluid_other.rst b/src/coreComponents/fileIO/schema/docs/CompositionalMultiphaseFluid_other.rst index 48cc0d27501..348627aa2f4 100644 --- a/src/coreComponents/fileIO/schema/docs/CompositionalMultiphaseFluid_other.rst +++ b/src/coreComponents/fileIO/schema/docs/CompositionalMultiphaseFluid_other.rst @@ -1,28 +1,28 @@ -====================================== ============================================== ========================== -Name Type Description -====================================== ============================================== ========================== -dPhaseCompFraction_dGlobalCompFraction Array< double, 5, long, ChaiVector< double > > (no description available) -dPhaseCompFraction_dPressure Array< double, 4, long, ChaiVector< double > > (no description available) -dPhaseCompFraction_dTemperature Array< double, 4, long, ChaiVector< double > > (no description available) -dPhaseDensity_dGlobalCompFraction Array< double, 4, long, ChaiVector< double > > (no description available) -dPhaseDensity_dPressure real64_array3d (no description available) -dPhaseDensity_dTemperature real64_array3d (no description available) -dPhaseFraction_dGlobalCompFraction Array< double, 4, long, ChaiVector< double > > (no description available) -dPhaseFraction_dPressure real64_array3d (no description available) -dPhaseFraction_dTemperature real64_array3d (no description available) -dPhaseViscosity_dGlobalCompFraction Array< double, 4, long, ChaiVector< double > > (no description available) -dPhaseViscosity_dPressure real64_array3d (no description available) -dPhaseViscosity_dTemperature real64_array3d (no description available) -dTotalDensity_dGlobalCompFraction real64_array3d (no description available) -dTotalDensity_dPressure real64_array2d (no description available) -dTotalDensity_dTemperature real64_array2d (no description available) -phaseCompFraction Array< double, 4, long, ChaiVector< double > > (no description available) -phaseDensity real64_array3d (no description available) -phaseFraction real64_array3d (no description available) -phaseViscosity real64_array3d (no description available) -totalDensity real64_array2d (no description available) -====================================== ============================================== ========================== +====================================== =================================================================================== ========================== +Name Type Description +====================================== =================================================================================== ========================== +dPhaseCompFraction_dGlobalCompFraction Array< double, 5, int_seq< long, 0l, 1l, 2l, 3l, 4l >, long, ChaiVector< double > > (no description available) +dPhaseCompFraction_dPressure Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +dPhaseCompFraction_dTemperature Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +dPhaseDensity_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +dPhaseDensity_dPressure real64_array3d (no description available) +dPhaseDensity_dTemperature real64_array3d (no description available) +dPhaseFraction_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +dPhaseFraction_dPressure real64_array3d (no description available) +dPhaseFraction_dTemperature real64_array3d (no description available) +dPhaseViscosity_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +dPhaseViscosity_dPressure real64_array3d (no description available) +dPhaseViscosity_dTemperature real64_array3d (no description available) +dTotalDensity_dGlobalCompFraction real64_array3d (no description available) +dTotalDensity_dPressure real64_array2d (no description available) +dTotalDensity_dTemperature real64_array2d (no description available) +phaseCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +phaseDensity real64_array3d (no description available) +phaseFraction real64_array3d (no description available) +phaseViscosity real64_array3d (no description available) +totalDensity real64_array2d (no description available) +====================================== =================================================================================== ========================== diff --git a/src/coreComponents/fileIO/schema/docs/LinearElasticAnisotropic_other.rst b/src/coreComponents/fileIO/schema/docs/LinearElasticAnisotropic_other.rst index 7ccdf5376d2..9ccf06f61bc 100644 --- a/src/coreComponents/fileIO/schema/docs/LinearElasticAnisotropic_other.rst +++ b/src/coreComponents/fileIO/schema/docs/LinearElasticAnisotropic_other.rst @@ -1,13 +1,13 @@ -================ ================================================================ ================================================== -Name Type Description -================ ================================================================ ================================================== -DeviatorStress r2Sym_array2d Stress Deviator -MeanStress real64_array2d Mean stress -defaultStiffness StiffnessTensor Default Elastic Stiffness Tensor in Voigt notation -density real64_array2d Material Density -stiffness Array< StiffnessTensor, 1, long, ChaiVector< StiffnessTensor > > Elastic Stiffness Field in Voigt notation -================ ================================================================ ================================================== +================ ===================================================================================== ================================================== +Name Type Description +================ ===================================================================================== ================================================== +DeviatorStress r2Sym_array2d Stress Deviator +MeanStress real64_array2d Mean stress +defaultStiffness StiffnessTensor Default Elastic Stiffness Tensor in Voigt notation +density real64_array2d Material Density +stiffness Array< StiffnessTensor, 1, int_seq< long, 0l >, long, ChaiVector< StiffnessTensor > > Elastic Stiffness Field in Voigt notation +================ ===================================================================================== ================================================== diff --git a/src/coreComponents/fileIO/schema/docs/PoroLinearElasticAnisotropic_other.rst b/src/coreComponents/fileIO/schema/docs/PoroLinearElasticAnisotropic_other.rst index 4b3f2a13e55..d428c98628c 100644 --- a/src/coreComponents/fileIO/schema/docs/PoroLinearElasticAnisotropic_other.rst +++ b/src/coreComponents/fileIO/schema/docs/PoroLinearElasticAnisotropic_other.rst @@ -1,15 +1,15 @@ -==================== ================================================================ ================================================== -Name Type Description -==================== ================================================================ ================================================== -DeviatorStress r2Sym_array2d Stress Deviator -MeanStress real64_array2d Mean stress -dPVMult_dDensity real64_array2d (no description available) -defaultStiffness StiffnessTensor Default Elastic Stiffness Tensor in Voigt notation -density real64_array2d Material Density -poreVolumeMultiplier real64_array2d (no description available) -stiffness Array< StiffnessTensor, 1, long, ChaiVector< StiffnessTensor > > Elastic Stiffness Field in Voigt notation -==================== ================================================================ ================================================== +==================== ===================================================================================== ================================================== +Name Type Description +==================== ===================================================================================== ================================================== +DeviatorStress r2Sym_array2d Stress Deviator +MeanStress real64_array2d Mean stress +dPVMult_dDensity real64_array2d (no description available) +defaultStiffness StiffnessTensor Default Elastic Stiffness Tensor in Voigt notation +density real64_array2d Material Density +poreVolumeMultiplier real64_array2d (no description available) +stiffness Array< StiffnessTensor, 1, int_seq< long, 0l >, long, ChaiVector< StiffnessTensor > > Elastic Stiffness Field in Voigt notation +==================== ===================================================================================== ================================================== diff --git a/src/coreComponents/fileIO/schema/docs/VanGenuchtenBakerRelativePermeability_other.rst b/src/coreComponents/fileIO/schema/docs/VanGenuchtenBakerRelativePermeability_other.rst index 292003fab09..1d1eaf9382b 100644 --- a/src/coreComponents/fileIO/schema/docs/VanGenuchtenBakerRelativePermeability_other.rst +++ b/src/coreComponents/fileIO/schema/docs/VanGenuchtenBakerRelativePermeability_other.rst @@ -1,11 +1,11 @@ -=============================== ============================================== ========================== -Name Type Description -=============================== ============================================== ========================== -dPhaseRelPerm_dPhaseVolFraction Array< double, 4, long, ChaiVector< double > > (no description available) -phaseRelPerm real64_array3d (no description available) -phaseTypes integer_array (no description available) -=============================== ============================================== ========================== +=============================== =============================================================================== ========================== +Name Type Description +=============================== =============================================================================== ========================== +dPhaseRelPerm_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +phaseRelPerm real64_array3d (no description available) +phaseTypes integer_array (no description available) +=============================== =============================================================================== ========================== diff --git a/src/coreComponents/fileIO/schema/docs/VanGenuchtenCapillaryPressure_other.rst b/src/coreComponents/fileIO/schema/docs/VanGenuchtenCapillaryPressure_other.rst index 6f980465d9a..1753ccb3bcc 100644 --- a/src/coreComponents/fileIO/schema/docs/VanGenuchtenCapillaryPressure_other.rst +++ b/src/coreComponents/fileIO/schema/docs/VanGenuchtenCapillaryPressure_other.rst @@ -1,12 +1,12 @@ -=================================== ============================================== ========================== -Name Type Description -=================================== ============================================== ========================== -dPhaseCapPressure_dPhaseVolFraction Array< double, 4, long, ChaiVector< double > > (no description available) -phaseCapPressure real64_array3d (no description available) -phaseOrder integer_array (no description available) -phaseTypes integer_array (no description available) -=================================== ============================================== ========================== +=================================== =============================================================================== ========================== +Name Type Description +=================================== =============================================================================== ========================== +dPhaseCapPressure_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) +phaseCapPressure real64_array3d (no description available) +phaseOrder integer_array (no description available) +phaseTypes integer_array (no description available) +=================================== =============================================================================== ========================== diff --git a/src/coreComponents/fileIO/schema/docs/WellElementRegionuniqueSubRegion_other.rst b/src/coreComponents/fileIO/schema/docs/WellElementRegionuniqueSubRegion_other.rst index eec88299bcc..bcb30c33b40 100644 --- a/src/coreComponents/fileIO/schema/docs/WellElementRegionuniqueSubRegion_other.rst +++ b/src/coreComponents/fileIO/schema/docs/WellElementRegionuniqueSubRegion_other.rst @@ -1,25 +1,25 @@ -========================== ================================================================= ========================================================= -Name Type Description -========================== ================================================================= ========================================================= -domainBoundaryIndicator integer_array (no description available) -elementCenter r1_array (no description available) -elementVolume real64_array (no description available) -ghostRank integer_array (no description available) -globalToLocalMap mapBase< long long, long, integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -nextWellElementIndex localIndex_array (no description available) -nextWellElementIndexGlobal localIndex_array (no description available) -nodeList InterObjectRelation< Array< long, 2, long, ChaiVector< long > > > (no description available) -topRank integer (no description available) -topWellElementIndex localIndex (no description available) -wellControlsName string (no description available) -ConstitutiveModels node :ref:`DATASTRUCTURE_ConstitutiveModels` -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -wellElementSubRegion node :ref:`DATASTRUCTURE_wellElementSubRegion` -========================== ================================================================= ========================================================= +========================== ========================================================================================== ========================================================= +Name Type Description +========================== ========================================================================================== ========================================================= +domainBoundaryIndicator integer_array (no description available) +elementCenter r1_array (no description available) +elementVolume real64_array (no description available) +ghostRank integer_array (no description available) +globalToLocalMap mapBase< long long, long, integral_constant< bool, false > > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +nextWellElementIndex localIndex_array (no description available) +nextWellElementIndexGlobal localIndex_array (no description available) +nodeList InterObjectRelation< Array< long, 2, int_seq< long, 0l, 1l >, long, ChaiVector< long > > > (no description available) +topRank integer (no description available) +topWellElementIndex localIndex (no description available) +wellControlsName string (no description available) +ConstitutiveModels node :ref:`DATASTRUCTURE_ConstitutiveModels` +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +wellElementSubRegion node :ref:`DATASTRUCTURE_wellElementSubRegion` +========================== ========================================================================================== ========================================================= diff --git a/src/coreComponents/fileIO/schema/docs/default_other.rst b/src/coreComponents/fileIO/schema/docs/default_other.rst index 7f9a1290507..4705b88b45d 100644 --- a/src/coreComponents/fileIO/schema/docs/default_other.rst +++ b/src/coreComponents/fileIO/schema/docs/default_other.rst @@ -1,26 +1,26 @@ -================================ ============================================================================================================================================= ============================================================= -Name Type Description -================================ ============================================================================================================================================= ============================================================= -domainBoundaryIndicator integer_array (no description available) -edgeList InterObjectRelation< Array< Array< long, 1, long, ChaiVector< long > >, 1, long, ChaiVector< Array< long, 1, long, ChaiVector< long > > > > > Map to the edges attached to each FaceElement. -elementAperture real64_array The aperture of each FaceElement. -elementArea real64_array The area of each FaceElement. -elementCenter r1_array The center of each FaceElement. -elementVolume real64_array The volume of each FaceElement. -faceList InterObjectRelation< Array< long, 2, long, ChaiVector< long > > > Map to the faces attached to each FaceElement. -fractureElementsToCellIndices localIndex_array2d A map of face element local indices to the cell local indices -fractureElementsToCellRegions localIndex_array2d A map of face element local indices to the cell local indices -fractureElementsToCellSubRegions localIndex_array2d A map of face element local indices to the cell local indices -ghostRank integer_array (no description available) -globalToLocalMap mapBase< long long, long, integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -nodeList InterObjectRelation< Array< Array< long, 1, long, ChaiVector< long > >, 1, long, ChaiVector< Array< long, 1, long, ChaiVector< long > > > > > Map to the nodes attached to each FaceElement. -ConstitutiveModels node :ref:`DATASTRUCTURE_ConstitutiveModels` -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -================================ ============================================================================================================================================= ============================================================= +================================ ============================================================================================================================================================================================================ ============================================================= +Name Type Description +================================ ============================================================================================================================================================================================================ ============================================================= +domainBoundaryIndicator integer_array (no description available) +edgeList InterObjectRelation< Array< Array< long, 1, int_seq< long, 0l >, long, ChaiVector< long > >, 1, int_seq< long, 0l >, long, ChaiVector< Array< long, 1, int_seq< long, 0l >, long, ChaiVector< long > > > > > Map to the edges attached to each FaceElement. +elementAperture real64_array The aperture of each FaceElement. +elementArea real64_array The area of each FaceElement. +elementCenter r1_array The center of each FaceElement. +elementVolume real64_array The volume of each FaceElement. +faceList InterObjectRelation< Array< long, 2, int_seq< long, 0l, 1l >, long, ChaiVector< long > > > Map to the faces attached to each FaceElement. +fractureElementsToCellIndices localIndex_array2d A map of face element local indices to the cell local indices +fractureElementsToCellRegions localIndex_array2d A map of face element local indices to the cell local indices +fractureElementsToCellSubRegions localIndex_array2d A map of face element local indices to the cell local indices +ghostRank integer_array (no description available) +globalToLocalMap mapBase< long long, long, integral_constant< bool, false > > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +nodeList InterObjectRelation< Array< Array< long, 1, int_seq< long, 0l >, long, ChaiVector< long > >, 1, int_seq< long, 0l >, long, ChaiVector< Array< long, 1, int_seq< long, 0l >, long, ChaiVector< long > > > > > Map to the nodes attached to each FaceElement. +ConstitutiveModels node :ref:`DATASTRUCTURE_ConstitutiveModels` +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +================================ ============================================================================================================================================================================================================ ============================================================= diff --git a/src/coreComponents/fileIO/schema/docs/domain_other.rst b/src/coreComponents/fileIO/schema/docs/domain_other.rst index dd6a0e09271..d35b3839cf3 100644 --- a/src/coreComponents/fileIO/schema/docs/domain_other.rst +++ b/src/coreComponents/fileIO/schema/docs/domain_other.rst @@ -1,13 +1,13 @@ -================ ========================================================================== ================================= -Name Type Description -================ ========================================================================== ================================= -Neighbors Array< NeighborCommunicator, 1, long, ChaiVector< NeighborCommunicator > > (no description available) -partitionManager PartitionBase (no description available) -Constitutive node :ref:`DATASTRUCTURE_Constitutive` -MeshBodies node :ref:`DATASTRUCTURE_MeshBodies` -cellManager node :ref:`DATASTRUCTURE_cellManager` -================ ========================================================================== ================================= +================ =============================================================================================== ================================= +Name Type Description +================ =============================================================================================== ================================= +Neighbors Array< NeighborCommunicator, 1, int_seq< long, 0l >, long, ChaiVector< NeighborCommunicator > > (no description available) +partitionManager PartitionBase (no description available) +Constitutive node :ref:`DATASTRUCTURE_Constitutive` +MeshBodies node :ref:`DATASTRUCTURE_MeshBodies` +cellManager node :ref:`DATASTRUCTURE_cellManager` +================ =============================================================================================== ================================= diff --git a/src/coreComponents/fileIO/schema/docs/edgeManager_other.rst b/src/coreComponents/fileIO/schema/docs/edgeManager_other.rst index a7d5bc30e8f..96a1e2d13e9 100644 --- a/src/coreComponents/fileIO/schema/docs/edgeManager_other.rst +++ b/src/coreComponents/fileIO/schema/docs/edgeManager_other.rst @@ -1,25 +1,25 @@ -================================ ================================================================= ==================================================================== -Name Type Description -================================ ================================================================= ==================================================================== -SIF_I real64_array SIF_I of the edge. -SIF_II real64_array SIF_II of the edge. -SIF_III real64_array SIF_III of the edge. -childIndex localIndex_array Child index of the edge. -domainBoundaryIndicator integer_array (no description available) -edgesToFractureConnectors mapBase< long, long, integral_constant< bool, true > > A map of edge local indices to the fracture connector local indices. -faceList InterObjectRelation< ArrayOfSets< long, long > > (no description available) -fractureConnectorsToEdges localIndex_array A map of fracture connector local indices to edge local indices. -fractureConnectorsToElementIndex ArrayOfArrays< long, long > A map of fracture connector local indices face element local indices -ghostRank integer_array (no description available) -globalToLocalMap mapBase< long long, long, integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -nodeList InterObjectRelation< Array< long, 2, long, ChaiVector< long > > > (no description available) -parentIndex localIndex_array Parent index of the edge. -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -================================ ================================================================= ==================================================================== +================================ ========================================================================================== ==================================================================== +Name Type Description +================================ ========================================================================================== ==================================================================== +SIF_I real64_array SIF_I of the edge. +SIF_II real64_array SIF_II of the edge. +SIF_III real64_array SIF_III of the edge. +childIndex localIndex_array Child index of the edge. +domainBoundaryIndicator integer_array (no description available) +edgesToFractureConnectors mapBase< long, long, integral_constant< bool, true > > A map of edge local indices to the fracture connector local indices. +faceList InterObjectRelation< ArrayOfSets< long, long > > (no description available) +fractureConnectorsToEdges localIndex_array A map of fracture connector local indices to edge local indices. +fractureConnectorsToElementIndex ArrayOfArrays< long, long > A map of fracture connector local indices face element local indices +ghostRank integer_array (no description available) +globalToLocalMap mapBase< long long, long, integral_constant< bool, false > > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +nodeList InterObjectRelation< Array< long, 2, int_seq< long, 0l, 1l >, long, ChaiVector< long > > > (no description available) +parentIndex localIndex_array Parent index of the edge. +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +================================ ========================================================================================== ==================================================================== diff --git a/src/coreComponents/fileIO/schema/schema.xsd.other b/src/coreComponents/fileIO/schema/schema.xsd.other index 0661520906c..190c0d049fd 100644 --- a/src/coreComponents/fileIO/schema/schema.xsd.other +++ b/src/coreComponents/fileIO/schema/schema.xsd.other @@ -597,7 +597,7 @@ - + @@ -621,25 +621,25 @@ - + - + - + - + - + - + @@ -651,7 +651,7 @@ - + @@ -663,7 +663,7 @@ - + @@ -671,7 +671,7 @@ - + @@ -681,7 +681,7 @@ - + @@ -689,25 +689,25 @@ - + - + - + - + - + - + @@ -719,7 +719,7 @@ - + @@ -750,7 +750,7 @@ - + @@ -784,7 +784,7 @@ - + @@ -804,7 +804,7 @@ - + @@ -812,7 +812,7 @@ - + @@ -896,7 +896,7 @@ - + @@ -1079,7 +1079,7 @@ - + @@ -1089,7 +1089,7 @@ - + @@ -1105,7 +1105,7 @@ - + @@ -1155,7 +1155,7 @@ - + diff --git a/src/coreComponents/fileIO/silo/SiloFile.cpp b/src/coreComponents/fileIO/silo/SiloFile.cpp index 7cc4921ed46..d611f07ff6a 100644 --- a/src/coreComponents/fileIO/silo/SiloFile.cpp +++ b/src/coreComponents/fileIO/silo/SiloFile.cpp @@ -1766,8 +1766,7 @@ void SiloFile::WriteMeshLevel( MeshLevel const * const meshLevel, array1d shapetype(numElementShapes); array1d shapesize(numElementShapes); - array1d elementToNodeMap; - elementToNodeMap.resize( numElementShapes ); + std::vector elementToNodeMap( numElementShapes ); int count = 0; elementManager->forElementSubRegions( [&]( auto const * const elementSubRegion ) diff --git a/src/coreComponents/finiteElement/ElementLibrary/FiniteElement.h b/src/coreComponents/finiteElement/ElementLibrary/FiniteElement.h index ef568db3cd3..50631a8f2fe 100644 --- a/src/coreComponents/finiteElement/ElementLibrary/FiniteElement.h +++ b/src/coreComponents/finiteElement/ElementLibrary/FiniteElement.h @@ -46,95 +46,84 @@ class FiniteElement : public FiniteElementBase { public: + /** + * Constructor. Takes an interpolation basis and quadrature rule, + * and pre-computes all static finite element data. Any data + * that depends on the mapped configuration of the element, however, + * is left uninitialized until reinit(...) is called. + */ FiniteElement( BasisBase const & basis, QuadratureBase const & quadrature, - const int num_zero_energy_modes = 0 ); - - ~FiniteElement() override - {} - - static string CatalogName() { return "C3D8"; } - - void reinit( arrayView1d< R1Tensor const > const & X, arraySlice1d< localIndex const > const & mapped_support_points ) override; - -}; - - - -/** - * Constructor. Takes an interpolation basis and quadrature rule, - * and pre-computes all static finite element data. Any data - * that depends on the mapped configuration of the element, however, - * is left uninitialized until reinit(...) is called. - */ - -template -FiniteElement :: FiniteElement( BasisBase const & basis, - QuadratureBase const & quadrature, - const int num_zero_energy_modes ): - FiniteElementBase( dim, quadrature.size(), basis.size(), num_zero_energy_modes) -{ - - data.resize(n_q_points); - for(auto q=0 ; q -void FiniteElement :: reinit( arrayView1d< R1Tensor const > const & X, arraySlice1d< localIndex const > const & mapped_support_points ) -{ - for(int q=0 ; q const & X, arraySlice1d< localIndex const, -1 > const & mapped_support_points ) override + { return reinitPrivate( X, mapped_support_points ); } + + void reinit( arrayView1d< R1Tensor const > const & X, arraySlice1d< localIndex const, 0 > const & mapped_support_points ) override + { return reinitPrivate( X, mapped_support_points ); } + +private: + /** + * Reinitialize the finite element basis on a particular element. + * We use the coordinates of the support points in real space to + * construct the forward mapping from the parent coordinate system. The + * support points are assumed to follow a lexicographic ordering: + * On the parent element, we loop over the x-coordinate fastest, + * the y, then z (depending on the desired spatial dimension of the + * element). + */ + template< int UNIT_STRIDE_DIM > + void reinitPrivate( arrayView1d< R1Tensor const > const & X, arraySlice1d< localIndex const, UNIT_STRIDE_DIM > const & mapped_support_points ) { - R2TensorT<3> jacobian; - jacobian.dyadic_ab( X[ mapped_support_points[0] ], data[q].parent_gradients[0] ); - - for(int a=1 ; a jacobian; + jacobian.dyadic_ab( X[ mapped_support_points[0] ], data[q].parent_gradients[0] ); - if( dim==2 ) - { - jacobian(2,2) = 1; - } + for(int a=1 ; a const & X, arraySlice1d< localIndex const > const & mapped_support_points ) = 0; + virtual void reinit( arrayView1d< R1Tensor const > const & X, arraySlice1d< localIndex const, -1 > const & mapped_support_points ) = 0; + virtual void reinit( arrayView1d< R1Tensor const > const & X, arraySlice1d< localIndex const, 0 > const & mapped_support_points ) = 0; + // virtual void zero_energy_mode_control( const array1d& dNdx, diff --git a/src/coreComponents/finiteElement/ElementLibrary/TetrahedralElement.cpp b/src/coreComponents/finiteElement/ElementLibrary/TetrahedralElement.cpp index 8d58c4a051e..fe78850880d 100644 --- a/src/coreComponents/finiteElement/ElementLibrary/TetrahedralElement.cpp +++ b/src/coreComponents/finiteElement/ElementLibrary/TetrahedralElement.cpp @@ -43,61 +43,6 @@ TetrahedralElement::~TetrahedralElement() {} - -void TetrahedralElement::reinit( arrayView1d< R1Tensor const > const & X_global, arraySlice1d< localIndex const > const & mapped_support_points ) -{ - const unsigned int q = 0; - - R1Tensor const X[4] = { X_global[ mapped_support_points[0] ], - X_global[ mapped_support_points[1] ], - X_global[ mapped_support_points[2] ], - X_global[ mapped_support_points[3] ] }; - - realT V, a[4], b[4], c[4]; - const realT sixth = 1.0 / 6.0; - - //a[1]=(y4-y2)*(z3-z2)-(y3-y2)*(z4-z2) - a[0] = (X[3][1] - X[1][1]) * (X[2][2] - X[1][2]) - (X[2][1] - X[1][1]) * (X[3][2] - X[1][2]); - // b[1]=x32 z42 - x42 z32 - b[0] = (X[2][0] - X[1][0]) * (X[3][2] - X[1][2]) - (X[3][0] - X[1][0]) * (X[2][2] - X[1][2]); - // c[1]=x42 y32 - x32 y42 - c[0] = (X[3][0] - X[1][0]) * (X[2][1] - X[1][1]) - (X[2][0] - X[1][0]) * (X[3][1] - X[1][1]); - // a[2]=y31 z43 - y34 z13 - a[1] = (X[2][1] - X[0][1]) * (X[3][2] - X[2][2]) - (X[2][1] - X[3][1]) * (X[0][2] - X[2][2]); - // b[2]=x43 z31 - x13 z34 - b[1] = (X[3][0] - X[2][0]) * (X[2][2] - X[0][2]) - (X[0][0] - X[2][0]) * (X[2][2] - X[3][2]); - // c[2]=x31 y43 - x34 y13 - c[1] = (X[2][0] - X[0][0]) * (X[3][1] - X[2][1]) - (X[2][0] - X[3][0]) * (X[0][1] - X[2][1]); - // a[3]=y24 z14 - y14 z24 - a[2] = (X[1][1] - X[3][1]) * (X[0][2] - X[3][2]) - (X[0][1] - X[3][1]) * (X[1][2] - X[3][2]); - // b[3]=x14 z24 - x24 z14 - b[2] = (X[0][0] - X[3][0]) * (X[1][2] - X[3][2]) - (X[1][0] - X[3][0]) * (X[0][2] - X[3][2]); - // c[3]=x24 y14 - x14 y24 - c[2] = (X[1][0] - X[3][0]) * (X[0][1] - X[3][1]) - (X[0][0] - X[3][0]) * (X[1][1] - X[3][1]); - // a[4]=y13 z21 - y12 z31 - a[3] = (X[0][1] - X[2][1]) * (X[1][2] - X[0][2]) - (X[0][1] - X[1][1]) * (X[2][2] - X[0][2]); - // b[4]=x21 z13 - x31 z12 - b[3] = (X[1][0] - X[0][0]) * (X[0][2] - X[2][2]) - (X[2][0] - X[0][0]) * (X[0][2] - X[1][2]); - // c[4]=x13 y21 - x12 y31 - c[3] = (X[0][0] - X[2][0]) * (X[1][1] - X[0][1]) - (X[0][0] - X[1][0]) * (X[2][1] - X[0][1]); - // - //6V=x21 (y23 z34 - y34 z23) + x32 (y34 z12 - y12 z34) + x43 (y12 z23 - y23 - // z12), - V = (X[1][0] - X[0][0]) * ((X[1][1] - X[2][1]) * (X[2][2] - X[3][2]) - (X[2][1] - X[3][1]) * (X[1][2] - X[2][2])) + (X[2][0] - X[1][0]) * - ((X[2][1] - X[3][1]) * (X[0][2] - X[1][2]) - (X[0][1] - X[1][1]) * (X[2][2] - X[3][2])) + (X[3][0] - X[2][0]) * - ((X[0][1] - X[1][1]) * (X[1][2] - X[2][2]) - (X[1][1] - X[2][1]) * (X[0][2] - X[1][2])); - V *= sixth; - - data[q].jacobian_determinant = V; - for( int iNd=0 ; iNd<4 ; ++iNd ) - { - data[q].mapped_gradients[iNd](0) = a[iNd] * sixth / data[q].jacobian_determinant; - data[q].mapped_gradients[iNd](1) = b[iNd] * sixth / data[q].jacobian_determinant; - data[q].mapped_gradients[iNd](2) = c[iNd] * sixth / data[q].jacobian_determinant; - } - - -} REGISTER_CATALOG_ENTRY( FiniteElementBase, TetrahedralElement, BasisBase const &, QuadratureBase const &, const int ) } diff --git a/src/coreComponents/finiteElement/ElementLibrary/TetrahedralElement.hpp b/src/coreComponents/finiteElement/ElementLibrary/TetrahedralElement.hpp index 24a3190b90d..504b4e7f358 100644 --- a/src/coreComponents/finiteElement/ElementLibrary/TetrahedralElement.hpp +++ b/src/coreComponents/finiteElement/ElementLibrary/TetrahedralElement.hpp @@ -34,7 +34,66 @@ class TetrahedralElement : public FiniteElementBase static string CatalogName() { return "C3D4"; } - void reinit( arrayView1d< R1Tensor const > const & X_global, arraySlice1d< localIndex const > const & mapped_support_points ) override; + void reinit( arrayView1d< R1Tensor const > const & X_global, arraySlice1d< localIndex const, -1 > const & mapped_support_points ) override + { return reinitPrivate( X_global, mapped_support_points ); } + + void reinit( arrayView1d< R1Tensor const > const & X_global, arraySlice1d< localIndex const, 0 > const & mapped_support_points ) override + { return reinitPrivate( X_global, mapped_support_points ); } + +private: + template< int UNIT_STRIDE_DIM > + void reinitPrivate( arrayView1d< R1Tensor const > const & X_global, arraySlice1d< localIndex const, UNIT_STRIDE_DIM > const & mapped_support_points ) + { + const unsigned int q = 0; + + R1Tensor const X[4] = { X_global[ mapped_support_points[0] ], + X_global[ mapped_support_points[1] ], + X_global[ mapped_support_points[2] ], + X_global[ mapped_support_points[3] ] }; + + realT V, a[4], b[4], c[4]; + const realT sixth = 1.0 / 6.0; + + //a[1]=(y4-y2)*(z3-z2)-(y3-y2)*(z4-z2) + a[0] = (X[3][1] - X[1][1]) * (X[2][2] - X[1][2]) - (X[2][1] - X[1][1]) * (X[3][2] - X[1][2]); + // b[1]=x32 z42 - x42 z32 + b[0] = (X[2][0] - X[1][0]) * (X[3][2] - X[1][2]) - (X[3][0] - X[1][0]) * (X[2][2] - X[1][2]); + // c[1]=x42 y32 - x32 y42 + c[0] = (X[3][0] - X[1][0]) * (X[2][1] - X[1][1]) - (X[2][0] - X[1][0]) * (X[3][1] - X[1][1]); + // a[2]=y31 z43 - y34 z13 + a[1] = (X[2][1] - X[0][1]) * (X[3][2] - X[2][2]) - (X[2][1] - X[3][1]) * (X[0][2] - X[2][2]); + // b[2]=x43 z31 - x13 z34 + b[1] = (X[3][0] - X[2][0]) * (X[2][2] - X[0][2]) - (X[0][0] - X[2][0]) * (X[2][2] - X[3][2]); + // c[2]=x31 y43 - x34 y13 + c[1] = (X[2][0] - X[0][0]) * (X[3][1] - X[2][1]) - (X[2][0] - X[3][0]) * (X[0][1] - X[2][1]); + // a[3]=y24 z14 - y14 z24 + a[2] = (X[1][1] - X[3][1]) * (X[0][2] - X[3][2]) - (X[0][1] - X[3][1]) * (X[1][2] - X[3][2]); + // b[3]=x14 z24 - x24 z14 + b[2] = (X[0][0] - X[3][0]) * (X[1][2] - X[3][2]) - (X[1][0] - X[3][0]) * (X[0][2] - X[3][2]); + // c[3]=x24 y14 - x14 y24 + c[2] = (X[1][0] - X[3][0]) * (X[0][1] - X[3][1]) - (X[0][0] - X[3][0]) * (X[1][1] - X[3][1]); + // a[4]=y13 z21 - y12 z31 + a[3] = (X[0][1] - X[2][1]) * (X[1][2] - X[0][2]) - (X[0][1] - X[1][1]) * (X[2][2] - X[0][2]); + // b[4]=x21 z13 - x31 z12 + b[3] = (X[1][0] - X[0][0]) * (X[0][2] - X[2][2]) - (X[2][0] - X[0][0]) * (X[0][2] - X[1][2]); + // c[4]=x13 y21 - x12 y31 + c[3] = (X[0][0] - X[2][0]) * (X[1][1] - X[0][1]) - (X[0][0] - X[1][0]) * (X[2][1] - X[0][1]); + // + //6V=x21 (y23 z34 - y34 z23) + x32 (y34 z12 - y12 z34) + x43 (y12 z23 - y23 + // z12), + V = (X[1][0] - X[0][0]) * ((X[1][1] - X[2][1]) * (X[2][2] - X[3][2]) - (X[2][1] - X[3][1]) * (X[1][2] - X[2][2])) + (X[2][0] - X[1][0]) * + ((X[2][1] - X[3][1]) * (X[0][2] - X[1][2]) - (X[0][1] - X[1][1]) * (X[2][2] - X[3][2])) + (X[3][0] - X[2][0]) * + ((X[0][1] - X[1][1]) * (X[1][2] - X[2][2]) - (X[1][1] - X[2][1]) * (X[0][2] - X[1][2])); + V *= sixth; + + data[q].jacobian_determinant = V; + for( int iNd=0 ; iNd<4 ; ++iNd ) + { + data[q].mapped_gradients[iNd](0) = a[iNd] * sixth / data[q].jacobian_determinant; + data[q].mapped_gradients[iNd](1) = b[iNd] * sixth / data[q].jacobian_determinant; + data[q].mapped_gradients[iNd](2) = c[iNd] * sixth / data[q].jacobian_determinant; + } + } }; } diff --git a/src/coreComponents/finiteElement/FiniteElementDiscretization.cpp b/src/coreComponents/finiteElement/FiniteElementDiscretization.cpp index 20d594923e2..3f374ff4a9c 100644 --- a/src/coreComponents/finiteElement/FiniteElementDiscretization.cpp +++ b/src/coreComponents/finiteElement/FiniteElementDiscretization.cpp @@ -91,36 +91,6 @@ void FiniteElementDiscretization::ApplySpaceToTargetCells( ElementSubRegionBase detJ.resize(cellBlock->size(), m_quadrature->size() ); } -void FiniteElementDiscretization::CalculateShapeFunctionGradients( arrayView1d const & X, - ElementSubRegionBase * const elementSubRegion ) const -{ - GEOSX_MARK_FUNCTION; - - arrayView3d const & dNdX = elementSubRegion->getReference< array3d< R1Tensor > >(keys::dNdX); - arrayView2d const & detJ = elementSubRegion->getReference< array2d >(keys::detJ); - FixedOneToManyRelation const & elemsToNodes = elementSubRegion->getWrapper(std::string("nodeList"))->reference(); - - PRAGMA_OMP( omp parallel ) - { - std::unique_ptr fe = getFiniteElement( m_parentSpace ); - - PRAGMA_OMP( omp for ) - for (localIndex k = 0 ; k < elementSubRegion->size() ; ++k) - { - fe->reinit(X, elemsToNodes[k]); - - for( localIndex q = 0 ; q < fe->n_quadrature_points() ; ++q ) - { - detJ(k, q) = fe->JxW(q); - for (localIndex b = 0 ; b < fe->dofs_per_element() ; ++b) - { - dNdX[k][q][b] = fe->gradient(b, q); - } - } - } - } -} - void FiniteElementDiscretization::PostProcessInput() { auto const & basisName = this->getReference(keys::basis); diff --git a/src/coreComponents/finiteElement/FiniteElementDiscretization.hpp b/src/coreComponents/finiteElement/FiniteElementDiscretization.hpp index 9253b3d04a3..aba279e5d15 100644 --- a/src/coreComponents/finiteElement/FiniteElementDiscretization.hpp +++ b/src/coreComponents/finiteElement/FiniteElementDiscretization.hpp @@ -16,10 +16,13 @@ * @file FiniteElementSpace.hpp */ -#ifndef GEOSX_FINITEELEMENT_FINITEELEMENTDISCRETIZATION_HPP_ -#define GEOSX_FINITEELEMENT_FINITEELEMENTDISCRETIZATION_HPP_ +#ifndef SRC_COMPONENTS_CORE_SRC_FINITEELEMENT_FINITEELEMENTSPACE_HPP_ +#define SRC_COMPONENTS_CORE_SRC_FINITEELEMENT_FINITEELEMENTSPACE_HPP_ + #include "dataRepository/Group.hpp" #include "dataRepository/Wrapper.hpp" +#include "ElementLibrary/FiniteElement.h" +#include "common/TimingMacros.hpp" namespace geosx { @@ -70,14 +73,39 @@ class FiniteElementDiscretization : public dataRepository::Group - + template< typename SUBREGION_TYPE > void CalculateShapeFunctionGradients( arrayView1d const & X, - ElementSubRegionBase * const cellBlock ) const; + SUBREGION_TYPE * const elementSubRegion ) const + { + GEOSX_MARK_FUNCTION; + + arrayView3d const & dNdX = elementSubRegion->template getReference< array3d< R1Tensor > >(dataRepository::keys::dNdX); + arrayView2d const & detJ = elementSubRegion->template getReference< array2d >(dataRepository::keys::detJ); + auto const & elemsToNodes = elementSubRegion->nodeList(); + + PRAGMA_OMP( omp parallel ) + { + std::unique_ptr fe = getFiniteElement( m_parentSpace ); + + PRAGMA_OMP( omp for ) + for (localIndex k = 0 ; k < elementSubRegion->size() ; ++k) + { + fe->reinit(X, elemsToNodes[k]); + + for( localIndex q = 0 ; q < fe->n_quadrature_points() ; ++q ) + { + detJ(k, q) = fe->JxW(q); + for (localIndex b = 0 ; b < fe->dofs_per_element() ; ++b) + { + dNdX[k][q][b] = fe->gradient(b, q); + } + } + } + } + } localIndex getNumberOfQuadraturePoints() const; -public: - string m_basisName; string m_quadratureName; string m_parentSpace; diff --git a/src/coreComponents/finiteVolume/unitTests/CMakeLists.txt b/src/coreComponents/finiteVolume/unitTests/CMakeLists.txt index 86be657ca76..3574741b2af 100644 --- a/src/coreComponents/finiteVolume/unitTests/CMakeLists.txt +++ b/src/coreComponents/finiteVolume/unitTests/CMakeLists.txt @@ -21,7 +21,6 @@ endif() # foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) - message("processing test_name ${test_name}") blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} diff --git a/src/coreComponents/linearAlgebra/DofManager.cpp b/src/coreComponents/linearAlgebra/DofManager.cpp index bf9bde20761..8bc90a286af 100644 --- a/src/coreComponents/linearAlgebra/DofManager.cpp +++ b/src/coreComponents/linearAlgebra/DofManager.cpp @@ -329,21 +329,21 @@ struct MapHelperImpl { }; -template< typename T > -struct MapHelperImpl< array2d > +template< typename T, typename PERMUTATION > +struct MapHelperImpl< array2d > { - static localIndex size0( array2d const & map ) + static localIndex size0( array2d const & map ) { return map.size( 0 ); } - static localIndex size1( array2d const & map, + static localIndex size1( array2d const & map, localIndex const GEOSX_UNUSED_ARG( i0 ) ) { return map.size( 1 ); } - static T const & value( array2d const & map, + static T const & value( array2d const & map, localIndex const i0, localIndex const i1 ) { diff --git a/src/coreComponents/linearAlgebra/unitTests/CMakeLists.txt b/src/coreComponents/linearAlgebra/unitTests/CMakeLists.txt index 1cd970dc934..e1056384e89 100644 --- a/src/coreComponents/linearAlgebra/unitTests/CMakeLists.txt +++ b/src/coreComponents/linearAlgebra/unitTests/CMakeLists.txt @@ -29,7 +29,6 @@ endif() foreach(test ${LAI_tests}) get_filename_component( test_name ${test} NAME_WE ) - message("processing test_name ${test_name}") blt_add_executable( NAME ${test_name} SOURCES ${test} diff --git a/src/coreComponents/managers/DomainPartition.cpp b/src/coreComponents/managers/DomainPartition.cpp index 68089aae9a0..b90675b41dc 100644 --- a/src/coreComponents/managers/DomainPartition.cpp +++ b/src/coreComponents/managers/DomainPartition.cpp @@ -80,7 +80,7 @@ void DomainPartition::InitializationOrder( string_array & order ) } -void DomainPartition::GenerateSets( ) +void DomainPartition::GenerateSets() { GEOSX_MARK_FUNCTION; @@ -113,10 +113,15 @@ void DomainPartition::GenerateSets( ) ElementRegionManager * const elementRegionManager = mesh->getElemManager(); - elementRegionManager->forElementSubRegions( [&]( ElementSubRegionBase * const subRegion ) + elementRegionManager->forElementSubRegionsComplete( [&]( localIndex const GEOSX_UNUSED_ARG( er ), + localIndex const GEOSX_UNUSED_ARG( esr ), + ElementRegionBase const * const GEOSX_UNUSED_ARG( region ), + auto * const subRegion ) { dataRepository::Group * elementSets = subRegion->sets(); + auto const & elemToNodeMap = subRegion->nodeList(); + for( std::string const & setName : setNames ) { arrayView1d const & nodeInCurSet = nodeInSet[setName]; @@ -124,10 +129,19 @@ void DomainPartition::GenerateSets( ) set & targetSet = elementSets->registerWrapper< set >(setName)->reference(); for( localIndex k = 0 ; k < subRegion->size() ; ++k ) { - localIndex const * const elemToNodes = subRegion->nodeList(k); localIndex const numNodes = subRegion->numNodesPerElement( k ); - if ( std::all_of( elemToNodes, elemToNodes + numNodes, [&nodeInCurSet](localIndex const nodeIndex) { return nodeInCurSet[nodeIndex]; } ) ) + localIndex elementInSet = true;; + for ( localIndex i = 0; i < numNodes; ++i ) + { + if ( !nodeInCurSet( elemToNodeMap[ k ][ i ] ) ) + { + elementInSet = false; + break; + } + } + + if ( elementInSet ) { targetSet.insert(k); } diff --git a/src/coreComponents/managers/FieldSpecification/FieldSpecificationBase.hpp b/src/coreComponents/managers/FieldSpecification/FieldSpecificationBase.hpp index 49102272b6c..a7532db0bd8 100644 --- a/src/coreComponents/managers/FieldSpecification/FieldSpecificationBase.hpp +++ b/src/coreComponents/managers/FieldSpecification/FieldSpecificationBase.hpp @@ -83,8 +83,8 @@ class FieldSpecificationBase : public dataRepository::Group */ virtual ~FieldSpecificationBase() override; - template < typename FIELD_OP, typename POLICY, typename T, int N > - void ApplyFieldValueKernel( LvArray::ArrayView< T, N, localIndex > const & field, + template < typename FIELD_OP, typename POLICY, typename T, int N, int UNIT_STRIDE_DIM > + void ApplyFieldValueKernel( LvArray::ArrayView< T, N, UNIT_STRIDE_DIM, localIndex > const & field, SortedArrayView< localIndex const > const & targetSet, real64 const time, Group * dataGroup ) const; @@ -357,8 +357,8 @@ class FieldSpecificationBase : public dataRepository::Group }; -template < typename FIELD_OP, typename POLICY, typename T, int N > -void FieldSpecificationBase::ApplyFieldValueKernel( LvArray::ArrayView< T, N, localIndex > const & field, +template < typename FIELD_OP, typename POLICY, typename T, int N, int UNIT_STRIDE_DIM > +void FieldSpecificationBase::ApplyFieldValueKernel( LvArray::ArrayView< T, N, UNIT_STRIDE_DIM, localIndex > const & field, SortedArrayView< localIndex const > const & targetSet, real64 const time, Group * dataGroup ) const diff --git a/src/coreComponents/managers/ObjectManagerBase.cpp b/src/coreComponents/managers/ObjectManagerBase.cpp index c3b3590175a..a49cf0ad6ec 100644 --- a/src/coreComponents/managers/ObjectManagerBase.cpp +++ b/src/coreComponents/managers/ObjectManagerBase.cpp @@ -868,9 +868,9 @@ void ObjectManagerBase::SetMaxGlobalIndex() MPI_COMM_GEOSX ); } -void ObjectManagerBase::CleanUpMap( std::set const & targetIndices, - array1d > & upmap, - array2d const & downmap ) +void ObjectManagerBase::CleanUpMap( std::set< localIndex > const & targetIndices, + array1d< set< localIndex > > & upmap, + arrayView2d< localIndex const > const & downmap ) { for( auto const & targetIndex : targetIndices ) { @@ -900,7 +900,7 @@ void ObjectManagerBase::CleanUpMap( std::set const & targetIndices, void ObjectManagerBase::CleanUpMap( std::set const & targetIndices, ArrayOfSetsView< localIndex > const & upmap, - array2d< localIndex const > const & downmap ) + arrayView2d< localIndex const > const & downmap ) { for( localIndex const targetIndex : targetIndices ) { @@ -934,7 +934,7 @@ void ObjectManagerBase::CleanUpMap( std::set const & targetIndices, void ObjectManagerBase::CleanUpMap( std::set const & targetIndices, array1d > & upmap, - array1d< array1d > const & downmap ) + arrayView1d< arrayView1d< localIndex const > const > const & downmap ) { for( auto const & targetIndex : targetIndices ) { @@ -964,7 +964,7 @@ void ObjectManagerBase::CleanUpMap( std::set const & targetIndices, void ObjectManagerBase::CleanUpMap( std::set< localIndex > const & targetIndices, ArrayOfSetsView< localIndex > const & upmap, - array1d< array1d< localIndex > > const & downmap ) + arrayView1d< arrayView1d< localIndex const > const > const & downmap ) { for( localIndex const targetIndex : targetIndices ) { diff --git a/src/coreComponents/managers/ObjectManagerBase.hpp b/src/coreComponents/managers/ObjectManagerBase.hpp index d09fcfc1fa1..0ff8c74911d 100644 --- a/src/coreComponents/managers/ObjectManagerBase.hpp +++ b/src/coreComponents/managers/ObjectManagerBase.hpp @@ -252,23 +252,23 @@ class ObjectManagerBase : public dataRepository::Group static void CleanUpMap( std::set const & targetIndices, array1d > & upmap, - array2d const & downmap ); + arrayView2d const & downmap ); static void CleanUpMap( std::set const & targetIndices, ArrayOfSetsView< localIndex > const & upmap, - array2d< localIndex const > const & downmap ); + arrayView2d< localIndex const > const & downmap ); static void CleanUpMap( std::set const & targetIndices, array1d > & upmap, - array1d< array1d > const & downmap ); + arrayView1d< arrayView1d const > const & downmap ); static void CleanUpMap( std::set const & targetIndices, ArrayOfSetsView< localIndex > const & upmap, - array1d< array1d > const & downmap ); + arrayView1d< arrayView1d< localIndex const > const > const & downmap ); static void CleanUpMap( std::set const & targetIndices, ArrayOfSetsView< localIndex > const & upmap, -ArrayOfArraysView< localIndex const > const & downmap ); + ArrayOfArraysView< localIndex const > const & downmap ); virtual void enforceStateFieldConsistencyPostTopologyChange( std::set const & targetIndices ); diff --git a/src/coreComponents/managers/unitTests/testMeshGeneration.cpp b/src/coreComponents/managers/unitTests/testMeshGeneration.cpp index e7beefccfbc..359a438ffbb 100644 --- a/src/coreComponents/managers/unitTests/testMeshGeneration.cpp +++ b/src/coreComponents/managers/unitTests/testMeshGeneration.cpp @@ -210,7 +210,7 @@ TEST_F( MeshGenerationTest, elementCentersAndVolumes ) TEST_F( MeshGenerationTest, elemToNodeMap ) { - arrayView2d< localIndex const > const & nodeMap = m_subRegion->nodeList(); + arrayView2d< localIndex const, CellBlock::NODE_MAP_UNIT_STRIDE_DIM > const & nodeMap = m_subRegion->nodeList(); GEOS_ERROR_IF_NE( nodeMap.size( 1 ), 8 ); localIndex elemID = 0; diff --git a/src/coreComponents/mesh/AggregateElementSubRegion.hpp b/src/coreComponents/mesh/AggregateElementSubRegion.hpp index 69e0fa0b734..2bfa5ef3a0f 100644 --- a/src/coreComponents/mesh/AggregateElementSubRegion.hpp +++ b/src/coreComponents/mesh/AggregateElementSubRegion.hpp @@ -90,26 +90,6 @@ class AggregateElementSubRegion : public ElementSubRegionBase static constexpr auto fineElementsListString = "fineElements"; }; - /*! - * @brief returns the element to node relations. - * @details The aggregates are elements composed of 1 node. - * @param[in] k the index of the element. - */ - virtual arraySlice1dRval nodeList( localIndex const k ) const override - { - return m_toNodesRelation[k]; - } - - /*! - * @brief returns the element to node relations. - * @details The aggregates are elements composed of 1 node. - * @param[in] k the index of the element. - */ - virtual arraySlice1dRval nodeList( localIndex const k ) override - { - return m_toNodesRelation[k]; - } - private: /// The elements to nodes relation is one to one relation. NodeMapType m_toNodesRelation; diff --git a/src/coreComponents/mesh/CellBlock.hpp b/src/coreComponents/mesh/CellBlock.hpp index 127f66fdac9..b869e65ff68 100644 --- a/src/coreComponents/mesh/CellBlock.hpp +++ b/src/coreComponents/mesh/CellBlock.hpp @@ -37,8 +37,16 @@ class CellBlock : public ElementSubRegionBase { public: - using NodeMapType=FixedOneToManyRelation; - using FaceMapType=FixedOneToManyRelation; +#if defined( GEOSX_USE_CUDA ) + using NODE_MAP_PERMUTATION = RAJA::PERM_JI; +#else + using NODE_MAP_PERMUTATION = RAJA::PERM_IJ; +#endif + + static constexpr int NODE_MAP_UNIT_STRIDE_DIM = LvArray::getStrideOneDimension( NODE_MAP_PERMUTATION {} ); + + using NodeMapType = InterObjectRelation< array2d< localIndex, NODE_MAP_PERMUTATION > >; + using FaceMapType = FixedOneToManyRelation; /** * @name Static Factory Catalog Functions @@ -178,36 +186,25 @@ class CellBlock : public ElementSubRegionBase virtual void setupRelatedObjectsInRelations( MeshLevel const * const mesh ) override; - virtual arraySlice1dRval nodeList( localIndex const k ) const override - { - return m_toNodesRelation[k]; - } - - virtual arraySlice1dRval nodeList( localIndex const k ) override - { - return m_toNodesRelation[k]; - } - - /** * @return the element to node map */ - FixedOneToManyRelation & nodeList() { return m_toNodesRelation; } + NodeMapType & nodeList() { return m_toNodesRelation; } /** * @return the element to node map */ - FixedOneToManyRelation const & nodeList() const { return m_toNodesRelation; } + NodeMapType const & nodeList() const { return m_toNodesRelation; } /** * @return the element to node map */ - localIndex & nodeList( localIndex const k, localIndex a ) { return m_toNodesRelation[k][a]; } + localIndex & nodeList( localIndex const k, localIndex a ) { return m_toNodesRelation( k, a ); } /** * @return the element to node map */ - localIndex const & nodeList( localIndex const k, localIndex a ) const { return m_toNodesRelation[k][a]; } + localIndex const & nodeList( localIndex const k, localIndex a ) const { return m_toNodesRelation( k, a ); } /** * @return the element to face map diff --git a/src/coreComponents/mesh/CellElementSubRegion.cpp b/src/coreComponents/mesh/CellElementSubRegion.cpp index 2dd130ad2a1..b6ebdc39cc9 100644 --- a/src/coreComponents/mesh/CellElementSubRegion.cpp +++ b/src/coreComponents/mesh/CellElementSubRegion.cpp @@ -119,14 +119,14 @@ localIndex CellElementSubRegion::PackUpDownMapsPrivate( buffer_unit_type * & buf localIndex packedSize = 0; packedSize += bufferOps::Pack( buffer, - nodeList().Base(), + nodeList().Base().toViewConst(), m_unmappedGlobalIndicesInNodelist, packList, this->m_localToGlobalMap, nodeList().RelatedObjectLocalToGlobal() ); packedSize += bufferOps::Pack( buffer, - faceList().Base(), + faceList().Base().toViewConst(), m_unmappedGlobalIndicesInFacelist, packList, this->m_localToGlobalMap, @@ -142,11 +142,8 @@ localIndex CellElementSubRegion::UnpackUpDownMaps( buffer_unit_type const * & bu bool const GEOSX_UNUSED_ARG( overwriteDownMaps ) ) { localIndex unPackedSize = 0; - - - unPackedSize += bufferOps::Unpack( buffer, - nodeList().Base(), + nodeList().Base().toView(), packList, m_unmappedGlobalIndicesInNodelist, this->m_globalToLocalMap, diff --git a/src/coreComponents/mesh/EdgeManager.cpp b/src/coreComponents/mesh/EdgeManager.cpp index cfe5d0a78de..00230841d7f 100644 --- a/src/coreComponents/mesh/EdgeManager.cpp +++ b/src/coreComponents/mesh/EdgeManager.cpp @@ -996,7 +996,7 @@ localIndex EdgeManager::PackUpDownMapsPrivate( buffer_unit_type * & buffer, packedSize += bufferOps::Pack( buffer, string(viewKeyStruct::nodeListString) ); packedSize += bufferOps::Pack( buffer, - m_toNodesRelation.Base(), + m_toNodesRelation.Base().toViewConst(), m_unmappedGlobalIndicesInToNodes, packList, m_localToGlobalMap, diff --git a/src/coreComponents/mesh/ElementSubRegionBase.hpp b/src/coreComponents/mesh/ElementSubRegionBase.hpp index f6f98b7e834..4c3af537a18 100644 --- a/src/coreComponents/mesh/ElementSubRegionBase.hpp +++ b/src/coreComponents/mesh/ElementSubRegionBase.hpp @@ -32,6 +32,7 @@ class DomainPartition; class ElementSubRegionBase : public ObjectManagerBase { public: + ElementSubRegionBase( string const & name, dataRepository::Group * const parent ); ~ElementSubRegionBase(); @@ -65,10 +66,6 @@ class ElementSubRegionBase : public ObjectManagerBase }; - virtual arraySlice1dRval nodeList( localIndex const k ) const = 0; - virtual arraySlice1dRval nodeList( localIndex const k ) = 0; - - /** * @return number of nodes per element */ diff --git a/src/coreComponents/mesh/FaceElementSubRegion.cpp b/src/coreComponents/mesh/FaceElementSubRegion.cpp index 1ecd4b258e0..40860428ede 100644 --- a/src/coreComponents/mesh/FaceElementSubRegion.cpp +++ b/src/coreComponents/mesh/FaceElementSubRegion.cpp @@ -187,7 +187,7 @@ localIndex FaceElementSubRegion::PackUpDownMapsPrivate( buffer_unit_type * & buf packedSize += bufferOps::Pack( buffer, string(viewKeyStruct::faceListString) ); packedSize += bufferOps::Pack( buffer, - m_toFacesRelation.Base(), + m_toFacesRelation.Base().toViewConst(), m_unmappedGlobalIndicesInToFaces, packList, this->m_localToGlobalMap, diff --git a/src/coreComponents/mesh/FaceElementSubRegion.hpp b/src/coreComponents/mesh/FaceElementSubRegion.hpp index da6f348b05d..8fbe53fdb25 100644 --- a/src/coreComponents/mesh/FaceElementSubRegion.hpp +++ b/src/coreComponents/mesh/FaceElementSubRegion.hpp @@ -114,17 +114,6 @@ class FaceElementSubRegion : public ElementSubRegionBase return m_toNodesRelation; } - - virtual arraySlice1dRval nodeList( localIndex const k ) const override - { - return m_toNodesRelation[k]; - } - - virtual arraySlice1dRval nodeList( localIndex const k ) override - { - return m_toNodesRelation[k]; - } - EdgeMapType const & edgeList() const { return m_toEdgesRelation; diff --git a/src/coreComponents/mesh/InterObjectRelation.hpp b/src/coreComponents/mesh/InterObjectRelation.hpp index d07fe4a2c84..86be48e8484 100644 --- a/src/coreComponents/mesh/InterObjectRelation.hpp +++ b/src/coreComponents/mesh/InterObjectRelation.hpp @@ -34,6 +34,11 @@ class InterObjectRelation : public BASETYPE using base_type = BASETYPE; + template< typename ...ARGS > + InterObjectRelation( ARGS && ...args ) : + BASETYPE( std::forward< ARGS >( args )... ) + {} + /// equals operator that sets *this to a single value of any type template InterObjectRelation& operator=( const rTYPE& rhs ) { diff --git a/src/coreComponents/mesh/MeshLevel.cpp b/src/coreComponents/mesh/MeshLevel.cpp index b2c35805ed3..22834006559 100644 --- a/src/coreComponents/mesh/MeshLevel.cpp +++ b/src/coreComponents/mesh/MeshLevel.cpp @@ -120,9 +120,9 @@ void MeshLevel::GenerateAdjacencyLists( localIndex_array & seedNodeList, WellElementSubRegion>([&]( localIndex const kSubReg, auto const * const subRegion ) { - - array2d const & elemsToNodes = subRegion->nodeList(); - array2d const & elemsToFaces = subRegion->faceList(); + using SubRegionType = std::remove_pointer_t< decltype( subRegion ) >; + arrayView2d< localIndex const, SubRegionType::NODE_MAP_UNIT_STRIDE_DIM > const & elemsToNodes = subRegion->nodeList(); + arrayView2d< localIndex const > const & elemsToFaces = subRegion->faceList(); for( auto const elementIndex : elementAdjacencySet[kReg][kSubReg] ) { for( localIndex a=0 ; aforElementSubRegionsIndex( [&]( localIndex const kSubReg, CellElementSubRegion const * const subRegion ) { - for( localIndex ke=0 ; kesize() ; ++ke ) + arrayView2d< localIndex const, CellElementSubRegion::NODE_MAP_UNIT_STRIDE_DIM > const & elemToNodeMap = subRegion->nodeList(); + + for( localIndex k=0 ; ksize() ; ++k ) { - arraySlice1d const elemToNodes = subRegion->nodeList(ke); - localIndex_array nodeIndices; for( localIndex a=0 ; anumNodesPerElement() ; ++a ) { - localIndex nodeIndex = elemToNodes[a]; + localIndex nodeIndex = elemToNodeMap( k, a ); if (std::find(nodeIndices.begin(), nodeIndices.end(), nodeIndex) == nodeIndices.end()) { toElementRegionList.appendToArray( nodeIndex, kReg ); toElementSubRegionList.appendToArray( nodeIndex, kSubReg ); - toElementList.appendToArray( nodeIndex, ke ); + toElementList.appendToArray( nodeIndex, k ); nodeIndices.push_back(nodeIndex); } @@ -351,12 +351,12 @@ void NodeManager::depopulateUpMaps( std::set const & receivedNodes, CellElementSubRegion const * subRegion = elemRegionManager.GetRegion(elemRegionIndex)-> GetSubRegion(elemSubRegionIndex); - array2d const & downmap = subRegion->nodeList(); + arrayView2d const & downmap = subRegion->nodeList(); bool hasTargetIndex = false; for( localIndex a=0 ; a(elemRegion->numNodesPerElement()); integer_array nodeIDInBox( numNodesPerElem ); - FixedOneToManyRelation & elemsToNodes = elemRegion->nodeList(); + arrayView2d< localIndex, CellBlock::NODE_MAP_UNIT_STRIDE_DIM > elemsToNodes = elemRegion->nodeList(); int numElemsInDirForRegion[3] = { lastElemIndexForBlockInPartition[0][iblock] - firstElemIndexForBlockInPartition[0][iblock] + 1, diff --git a/src/coreComponents/mpiCommunications/CommunicationTools.cpp b/src/coreComponents/mpiCommunications/CommunicationTools.cpp index d478f58f715..1230a8609f9 100644 --- a/src/coreComponents/mpiCommunications/CommunicationTools.cpp +++ b/src/coreComponents/mpiCommunications/CommunicationTools.cpp @@ -119,7 +119,7 @@ void CommunicationTools::AssignGlobalIndices( ObjectManagerBase & object, // is the lowest global index of the composition object that make up this object. The value of the map is a pair, with // the array being the remaining composition object global indices, and the second being the global index of the object // itself. - map > > indexByFirstCompositionIndex; + map, localIndex> > > indexByFirstCompositionIndex; localIndex bufferSize = 0; for( std::size_t a = 0 ; a < objectToCompositionObject.size() ; ++a ) @@ -133,10 +133,10 @@ void CommunicationTools::AssignGlobalIndices( ObjectManagerBase & object, const globalIndex firstCompositionIndex = nodeList[0]; // create a temporary to hold the pair - std::pair tempComp; + std::pair, globalIndex> tempComp; // fill the array with the remaining composition object global indices - tempComp.first.insert(0, &nodeList[1], nodeList.size() - 1 ); + tempComp.first.insert(tempComp.first.begin(), nodeList.begin() + 1, nodeList.end() ); // set the second value of the pair to the localIndex of the object. tempComp.second = a; @@ -236,8 +236,8 @@ void CommunicationTools::AssignGlobalIndices( ObjectManagerBase & object, // object to receive the neighbor data // this baby is an Array (for each neighbor) of maps, with the key of lowest composition index, and a value // containing an array containing the std::pairs of the remaining composition indices, and the globalIndex of the object. - array1d > > > - neighborCompositionObjects( neighbors.size() ); + std::vector, globalIndex> > > > + neighborCompositionObjects( neighbors.size() ); for( int count=0 ; count temp; for( localIndex b = 1 ; b < dataSize ; ++b ) { temp.push_back( *( recBuffer++ ) ); } // fill neighborCompositionObjects - std::pair + std::pair, globalIndex> tempComp( std::make_pair( std::move(temp), std::move(neighborGlobalIndex) ) ); // tempComp( std::make_pair( temp, neighborGlobalIndex ) ); @@ -290,9 +290,9 @@ void CommunicationTools::AssignGlobalIndices( ObjectManagerBase & object, // Set iterators to the beginning of each indexByFirstCompositionIndex, // and neighborCompositionObjects[neighborNum]. - map > >::const_iterator + map, localIndex> > >::const_iterator iter_local = indexByFirstCompositionIndex.begin(); - map > >::const_iterator + map, globalIndex> > >::const_iterator iter_neighbor = neighborCompositionObjects[neighborIndex].begin(); // now we continue the while loop as long as both of our iterators are in range. @@ -303,12 +303,12 @@ void CommunicationTools::AssignGlobalIndices( ObjectManagerBase & object, if( iter_local->first == iter_neighbor->first ) { // first we loop over all local composition arrays (objects with the matched key) - for( array1d >::const_iterator + for( std::vector, localIndex> >::const_iterator iter_local2 = iter_local->second.begin() ; iter_local2 != iter_local->second.end() ; ++iter_local2 ) { // and loop over all of the neighbor composition arrays (objects with the matched key) - for( array1d >::const_iterator + for( std::vector, globalIndex> >::const_iterator iter_neighbor2 = iter_neighbor->second.begin() ; iter_neighbor2 != iter_neighbor->second.end() ; ++iter_neighbor2 ) @@ -581,7 +581,6 @@ void CommunicationTools::FindGhosts( MeshLevel * const meshLevel, } } - CommunicationTools::releaseCommID( commID ); } diff --git a/src/coreComponents/mpiCommunications/CommunicationTools.hpp b/src/coreComponents/mpiCommunications/CommunicationTools.hpp index 126781a1913..a1674b023b0 100644 --- a/src/coreComponents/mpiCommunications/CommunicationTools.hpp +++ b/src/coreComponents/mpiCommunications/CommunicationTools.hpp @@ -23,6 +23,8 @@ #include "common/DataTypes.hpp" +#include + namespace geosx { diff --git a/src/coreComponents/mpiCommunications/NeighborCommunicator.cpp b/src/coreComponents/mpiCommunications/NeighborCommunicator.cpp index e62a4b68444..08a54f8be57 100644 --- a/src/coreComponents/mpiCommunications/NeighborCommunicator.cpp +++ b/src/coreComponents/mpiCommunications/NeighborCommunicator.cpp @@ -456,22 +456,22 @@ void NeighborCommunicator::RebuildSyncLists( MeshLevel * const mesh, int bufferSize = 0; bufferSize += bufferOps::Pack( sendBufferPtr, - nodeGhostsToReceive, - array1d(), + nodeGhostsToReceive.toSliceConst(), + nullptr, nodeGhostsToReceive.size(), - nodeManager.m_localToGlobalMap ); + nodeManager.m_localToGlobalMap.toSliceConst() ); bufferSize += bufferOps::Pack( sendBufferPtr, - edgeGhostsToReceive, - array1d(), + edgeGhostsToReceive.toSliceConst(), + nullptr, edgeGhostsToReceive.size(), - edgeManager.m_localToGlobalMap ); + edgeManager.m_localToGlobalMap.toSliceConst() ); bufferSize += bufferOps::Pack( sendBufferPtr, - faceGhostsToReceive, - array1d(), + faceGhostsToReceive.toSliceConst(), + nullptr, faceGhostsToReceive.size(), - faceManager.m_localToGlobalMap ); + faceManager.m_localToGlobalMap.toSliceConst() ); for( localIndex er=0 ; er( sendBufferPtr, - elementGhostToReceive[er][esr], - array1d(), + elementGhostToReceive[er][esr].toSliceConst(), + nullptr, elementGhostToReceive[er][esr].size(), - subRegion->m_localToGlobalMap ); + subRegion->m_localToGlobalMap.toSliceConst() ); }); } @@ -491,22 +491,22 @@ void NeighborCommunicator::RebuildSyncLists( MeshLevel * const mesh, int packedSize = 0; packedSize += bufferOps::Pack( sendBufferPtr, - nodeGhostsToReceive, - array1d(), + nodeGhostsToReceive.toSliceConst(), + nullptr, nodeGhostsToReceive.size(), - nodeManager.m_localToGlobalMap ); + nodeManager.m_localToGlobalMap.toSliceConst() ); packedSize += bufferOps::Pack( sendBufferPtr, - edgeGhostsToReceive, - array1d(), + edgeGhostsToReceive.toSliceConst(), + nullptr, edgeGhostsToReceive.size(), - edgeManager.m_localToGlobalMap ); + edgeManager.m_localToGlobalMap.toSliceConst() ); packedSize += bufferOps::Pack( sendBufferPtr, - faceGhostsToReceive, - array1d(), + faceGhostsToReceive.toSliceConst(), + nullptr, faceGhostsToReceive.size(), - faceManager.m_localToGlobalMap ); + faceManager.m_localToGlobalMap.toSliceConst() ); @@ -516,10 +516,10 @@ void NeighborCommunicator::RebuildSyncLists( MeshLevel * const mesh, elemRegion->forElementSubRegionsIndex([&]( localIndex const esr, ElementSubRegionBase const * const subRegion ) { packedSize+= bufferOps::Pack( sendBufferPtr, - elementGhostToReceive[er][esr], - array1d(), + elementGhostToReceive[er][esr].toSliceConst(), + nullptr, elementGhostToReceive[er][esr].size(), - subRegion->m_localToGlobalMap ); + subRegion->m_localToGlobalMap.toSliceConst() ); }); } diff --git a/src/coreComponents/physicsSolvers/CoupledSolvers/PoroelasticSolver.cpp b/src/coreComponents/physicsSolvers/CoupledSolvers/PoroelasticSolver.cpp index 5804c51d7ae..74153e5d494 100644 --- a/src/coreComponents/physicsSolvers/CoupledSolvers/PoroelasticSolver.cpp +++ b/src/coreComponents/physicsSolvers/CoupledSolvers/PoroelasticSolver.cpp @@ -203,8 +203,8 @@ void PoroelasticSolver::UpdateDeformationForCoupling( DomainPartition * const do arrayView1d const & u = nodeManager->getReference(keys::TotalDisplacement); arrayView1d const & uhat = nodeManager->getReference(keys::IncrementalDisplacement); - ElementRegionManager::ElementViewAccessor> const elemsToNodes = - elemManager->ConstructViewAccessor>( CellElementSubRegion::viewKeyStruct::nodeListString ); + ElementRegionManager::ElementViewAccessor> const elemsToNodes = + elemManager->ConstructViewAccessor>( CellElementSubRegion::viewKeyStruct::nodeListString ); ElementRegionManager::ElementViewAccessor> totalMeanStress = elemManager->ConstructViewAccessor, arrayView1d>(viewKeyStruct::totalMeanStressString); diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/SinglePhaseFlow.cpp b/src/coreComponents/physicsSolvers/FiniteVolume/SinglePhaseFlow.cpp index 486919632ef..32ea8a0975f 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/SinglePhaseFlow.cpp +++ b/src/coreComponents/physicsSolvers/FiniteVolume/SinglePhaseFlow.cpp @@ -1043,7 +1043,6 @@ real64 SinglePhaseFlow::CalculateResidualNorm( DomainPartition const * const dom arrayView1d const & refPoro = m_porosityRef[er][esr]; arrayView1d const & volume = m_volume[er][esr]; arrayView1d const & dVol = m_deltaVolume[er][esr]; -// arrayView1d const & dens = m_density[er][esr][m_fluidIndex].dimReduce(); arrayView2d const & dens = m_density[er][esr][m_fluidIndex]; localIndex const subRegionSize = subRegion->size(); diff --git a/src/coreComponents/physicsSolvers/SimpleSolvers/LaplaceFEM.cpp b/src/coreComponents/physicsSolvers/SimpleSolvers/LaplaceFEM.cpp index 62f9f620ef3..4a9c17cf244 100644 --- a/src/coreComponents/physicsSolvers/SimpleSolvers/LaplaceFEM.cpp +++ b/src/coreComponents/physicsSolvers/SimpleSolvers/LaplaceFEM.cpp @@ -210,10 +210,8 @@ void LaplaceFEM::AssembleSystem( real64 const time_n, arrayView2d const & detJ = elementSubRegion->getReference< array2d >(keys::detJ); - arrayView2d const & elemsToNodes = elementSubRegion->nodeList(); - localIndex const numNodesPerElement = integer_conversion(elemsToNodes.size(1)); - - arrayView2d const & elemNodes = elementSubRegion->nodeList(); + localIndex const numNodesPerElement = elementSubRegion->numNodesPerElement(); + arrayView2d const & elemNodes = elementSubRegion->nodeList(); globalIndex_array elemDofIndex( numNodesPerElement ); real64_array element_rhs( numNodesPerElement ); diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp index 4ce04f896a8..f32fdaa746e 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp @@ -279,7 +279,7 @@ void SolidMechanicsLagrangianFEM::updateIntrinsicNodalData( DomainPartition * co elemRegion->forElementSubRegionsIndex([&]( localIndex const esr, CellElementSubRegion const * const elementSubRegion ) { arrayView2d const & detJ = elementSubRegion->getReference< array2d >(keys::detJ); - arrayView2d const & elemsToNodes = elementSubRegion->nodeList(); + arrayView2d const & elemsToNodes = elementSubRegion->nodeList(); std::unique_ptr fe = feDiscretization->getFiniteElement( elementSubRegion->GetElementTypeString() ); @@ -361,7 +361,7 @@ void SolidMechanicsLagrangianFEM::InitializePostInitialConditions_PreSubGroups( + std::to_string(er) + "][" + std::to_string(esr) + "]" ); arrayView2d const & detJ = elementSubRegion->getReference< array2d >(keys::detJ); - arrayView2d const & elemsToNodes = elementSubRegion->nodeList(); + arrayView2d const & elemsToNodes = elementSubRegion->nodeList(); std::unique_ptr fe = feDiscretization->getFiniteElement( elementSubRegion->GetElementTypeString() ); @@ -556,7 +556,7 @@ real64 SolidMechanicsLagrangianFEM::ExplicitStep( real64 const& time_n, arrayView2d const & detJ = elementSubRegion->getReference< array2d >(keys::detJ); - arrayView2d const & elemsToNodes = elementSubRegion->nodeList(); + arrayView2d const & elemsToNodes = elementSubRegion->nodeList(); localIndex const numNodesPerElement = elemsToNodes.size(1); @@ -601,7 +601,7 @@ real64 SolidMechanicsLagrangianFEM::ExplicitStep( real64 const& time_n, arrayView2d const & detJ = elementSubRegion->getReference< array2d >(keys::detJ); - arrayView2d const & elemsToNodes = elementSubRegion->nodeList(); + arrayView2d const & elemsToNodes = elementSubRegion->nodeList(); localIndex const numNodesPerElement = elemsToNodes.size(1); @@ -1049,7 +1049,7 @@ void SolidMechanicsLagrangianFEM::AssembleSystem( real64 const GEOSX_UNUSED_ARG( arrayView2d const & detJ = elementSubRegion->getReference< array2d >(keys::detJ); - arrayView2d< localIndex > const & elemsToNodes = elementSubRegion->nodeList(); + arrayView2d< localIndex const, CellBlock::NODE_MAP_UNIT_STRIDE_DIM > const & elemsToNodes = elementSubRegion->nodeList(); localIndex const numNodesPerElement = elemsToNodes.size(1); std::unique_ptr diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp index a4785b3ccfd..cb9b3ccee81 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp @@ -178,7 +178,7 @@ class SolidMechanicsLagrangianFEM : public SolverBase localIndex NUM_QUADRATURE_POINTS, constitutive::ConstitutiveBase * const constitutiveRelation, set const & elementList, - arrayView2d const & elemsToNodes, + arrayView2d const & elemsToNodes, arrayView3d< R1Tensor const> const & dNdX, arrayView2d const & detJ, arrayView1d const & u, @@ -247,7 +247,7 @@ class SolidMechanicsLagrangianFEM : public SolverBase arrayView2d const& detJ, FiniteElementBase const * const fe, arrayView1d< integer const > const & elemGhostRank, - arrayView2d< localIndex const > const & elemsToNodes, + arrayView2d< localIndex const, CellBlock::NODE_MAP_UNIT_STRIDE_DIM > const & elemsToNodes, arrayView1d< globalIndex const > const & globalDofNumber, arrayView1d< R1Tensor const > const & disp, arrayView1d< R1Tensor const > const & uhat, diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEMKernels.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEMKernels.hpp index 20c16faea4d..d86efe54d23 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEMKernels.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEMKernels.hpp @@ -192,7 +192,7 @@ struct ExplicitKernel static inline real64 Launch( CONSTITUTIVE_TYPE * const constitutiveRelation, LvArray::SortedArrayView const & elementList, - arrayView2d const & elemsToNodes, + arrayView2d const & elemsToNodes, arrayView3d< R1Tensor const> const & dNdX, arrayView2d const & detJ, arrayView1d const & u, @@ -383,7 +383,7 @@ struct ImplicitKernel arrayView2d const& GEOSX_UNUSED_ARG( detJ ), FiniteElementBase const * const GEOSX_UNUSED_ARG( fe ), arrayView1d< integer const > const & GEOSX_UNUSED_ARG( elemGhostRank ), - arrayView2d< localIndex const > const & GEOSX_UNUSED_ARG( elemsToNodes ), + arrayView2d< localIndex const, CellBlock::NODE_MAP_UNIT_STRIDE_DIM > const & GEOSX_UNUSED_ARG( elemsToNodes ), arrayView1d< globalIndex const > const & GEOSX_UNUSED_ARG( globalDofNumber ), arrayView1d< R1Tensor const > const & GEOSX_UNUSED_ARG( disp ), arrayView1d< R1Tensor const > const & GEOSX_UNUSED_ARG( uhat ), diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLE.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLE.cpp index 9d943d88166..aec6b7d7220 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLE.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLE.cpp @@ -85,7 +85,7 @@ void SolidMechanicsLagrangianSSLE::ApplySystemSolution( DofManager const & dofMa arrayView2d const & detJ = elementSubRegion->getReference< array2d >(dataRepository::keys::detJ); - arrayView2d< localIndex > const & elemsToNodes = elementSubRegion->nodeList(); + arrayView2d< localIndex const, CellBlock::NODE_MAP_UNIT_STRIDE_DIM > const & elemsToNodes = elementSubRegion->nodeList(); localIndex const numNodesPerElement = elemsToNodes.size(1); std::unique_ptr diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLE.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLE.hpp index 679278dcfa0..f6041b9b8a2 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLE.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLE.hpp @@ -52,7 +52,7 @@ class SolidMechanicsLagrangianSSLE : public SolidMechanicsLagrangianFEM localIndex NUM_QUADRATURE_POINTS, constitutive::ConstitutiveBase * const constitutiveRelation, set const & elementList, - arrayView2d const & elemsToNodes, + arrayView2d const & elemsToNodes, arrayView3d< R1Tensor const> const & dNdX, arrayView2d const & detJ, arrayView1d const & u, @@ -89,7 +89,7 @@ class SolidMechanicsLagrangianSSLE : public SolidMechanicsLagrangianFEM arrayView2d const& detJ, FiniteElementBase const * const fe, arrayView1d< integer const > const & elemGhostRank, - arrayView2d< localIndex const > const & elemsToNodes, + arrayView2d< localIndex const, CellBlock::NODE_MAP_UNIT_STRIDE_DIM > const & elemsToNodes, arrayView1d< globalIndex const > const & globalDofNumber, arrayView1d< R1Tensor const > const & disp, arrayView1d< R1Tensor const > const & uhat, diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLEKernels.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLEKernels.hpp index ddc49219ef4..057d878a7e8 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLEKernels.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianSSLEKernels.hpp @@ -45,10 +45,10 @@ struct StressCalculationKernel static inline real64 Launch( CONSTITUTIVE_TYPE * const constitutiveRelation, localIndex const numElems, - arrayView2d const & elemsToNodes, + arrayView2d< localIndex const, CellBlock::NODE_MAP_UNIT_STRIDE_DIM > const & elemsToNodes, arrayView3d< R1Tensor const> const & dNdX, arrayView2d const & GEOSX_UNUSED_ARG( detJ ), - arrayView1d const & u ) + arrayView1d< R1Tensor const > const & u ) { GEOSX_MARK_FUNCTION; @@ -136,7 +136,7 @@ struct ExplicitKernel static inline real64 Launch( CONSTITUTIVE_TYPE * const constitutiveRelation, LvArray::SortedArrayView const & elementList, - arrayView2d const & elemsToNodes, + arrayView2d const & elemsToNodes, arrayView3d< R1Tensor const> const & dNdX, arrayView2d const & detJ, arrayView1d const & GEOSX_UNUSED_ARG( u ), @@ -276,7 +276,7 @@ struct ImplicitKernel arrayView2d const& detJ, FiniteElementBase const * const fe, arrayView1d< integer const > const & elemGhostRank, - arrayView2d< localIndex const > const & elemsToNodes, + arrayView2d< localIndex const, CellBlock::NODE_MAP_UNIT_STRIDE_DIM > const & elemsToNodes, arrayView1d< globalIndex const > const & globalDofNumber, arrayView1d< R1Tensor const > const & disp, arrayView1d< R1Tensor const > const & uhat, diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp index 5c708716cab..c69b0d4d080 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp @@ -489,8 +489,8 @@ int SurfaceGenerator::SeparationDriver( DomainPartition * domain, FaceManager & faceManager = *(mesh->getFaceManager()); ElementRegionManager & elementManager = *(mesh->getElemManager()); - array1d > nodesToRupturedFaces; - array1d > edgesToRupturedFaces; + std::vector > nodesToRupturedFaces; + std::vector > edgesToRupturedFaces; ArrayOfArraysView const & nodeToElementMap = nodeManager.elementList(); ArrayOfArraysView const & faceToNodeMap = faceManager.nodeList(); @@ -758,8 +758,8 @@ bool SurfaceGenerator::ProcessNode( const localIndex nodeID, EdgeManager & edgeManager, FaceManager & faceManager, ElementRegionManager & elemManager, - arrayView1d >& nodesToRupturedFaces, - arrayView1d >& edgesToRupturedFaces, + std::vector >& nodesToRupturedFaces, + std::vector >& edgesToRupturedFaces, ElementRegionManager & elementManager, ModifiedObjectLists& modifiedObjects, const bool GEOSX_UNUSED_ARG( prefrac ) ) @@ -818,8 +818,8 @@ bool SurfaceGenerator::FindFracturePlanes( const localIndex nodeID, const EdgeManager & edgeManager, const FaceManager & faceManager, ElementRegionManager & elemManager, - const arrayView1d >& nodesToRupturedFaces, - const arrayView1d >& edgesToRupturedFaces, + const std::vector >& nodesToRupturedFaces, + const std::vector >& edgesToRupturedFaces, std::set& separationPathFaces, map& edgeLocations, map& faceLocations, @@ -1506,8 +1506,8 @@ void SurfaceGenerator::PerformFracture( const localIndex nodeID, FaceManager & faceManager, ElementRegionManager & elementManager, ModifiedObjectLists& modifiedObjects, - arrayView1d >& GEOSX_UNUSED_ARG( nodesToRupturedFaces ), - arrayView1d >& GEOSX_UNUSED_ARG( edgesToRupturedFaces ), + std::vector >& GEOSX_UNUSED_ARG( nodesToRupturedFaces ), + std::vector >& GEOSX_UNUSED_ARG( edgesToRupturedFaces ), const std::set& separationPathFaces, const map& edgeLocations, const map& faceLocations, @@ -1823,7 +1823,7 @@ void SurfaceGenerator::PerformFracture( const localIndex nodeID, modifiedObjects.modifiedElements[{regionIndex,subRegionIndex}].insert( elemIndex ); - arrayView2d & elemsToNodes = elemSubRegion.nodeList(); + arrayView2d const & elemsToNodes = elemSubRegion.nodeList(); arrayView2d & elemsToFaces = elemSubRegion.faceList(); if( verboseLevel() > 1 ) @@ -2175,7 +2175,7 @@ void SurfaceGenerator::MapConsistencyCheck( localIndex const GEOSX_UNUSED_ARG( n CellElementSubRegion& elemSubRegion = *(elem.first); const localIndex elemIndex = elem.second; - arrayView2d & elemsToNodes = elemSubRegion.nodeList(); + arrayView2d const & elemsToNodes = elemSubRegion.nodeList(); arrayView2d & elemsToFaces = elemSubRegion.faceList(); @@ -2249,7 +2249,7 @@ void SurfaceGenerator::MapConsistencyCheck( localIndex const GEOSX_UNUSED_ARG( n if( verboseLevel() > 2 ) { // nodeToEdge - array1d > inverseEdgesToNodes( nodeManager.size() ); + std::vector > inverseEdgesToNodes( nodeManager.size() ); for( localIndex ke=0 ; ke 2 ) { // nodeToFace - array1d > inverseFacesToNodes( nodeManager.size() ); + std::vector > inverseFacesToNodes( nodeManager.size() ); for( localIndex kf=0 ; kf > > inverseElemsToNodes( nodeManager.size() ); + std::vector > > inverseElemsToNodes( nodeManager.size() ); for( localIndex er=0 ; er( esr ); if( subRegion != nullptr ) { - arrayView2d const & elemsToNodes = subRegion->nodeList(); + arrayView2d const & elemsToNodes = subRegion->nodeList(); for( localIndex k=0 ; ksize() ; ++k ) { std::pair elem = std::make_pair( subRegion, k ); @@ -2390,7 +2390,7 @@ void SurfaceGenerator::MapConsistencyCheck( localIndex const GEOSX_UNUSED_ARG( n // edgeToFace - array1d > inverseFacesToEdges( edgeManager.size() ); + std::vector > inverseFacesToEdges( edgeManager.size() ); for( localIndex kf=0 ; kf > > inverseElemsToFaces( faceManager.size() ); + std::vector > > inverseElemsToFaces( faceManager.size() ); for( localIndex er=0 ; ergetName(); localIndex const er = elementManager.GetRegions().getIndex( elementRegionName ); localIndex const esr = elementRegion->GetSubRegions().getIndex( elementSubRegion->getName() ); - arrayView2d & elementsToNodes = elementSubRegion->nodeList(); + arrayView2d const & elementsToNodes = elementSubRegion->nodeList(); xEle = elementSubRegion->getElementCenter()[iEle]; @@ -2825,7 +2825,7 @@ void SurfaceGenerator::CalculateNodeAndFaceSIF( DomainPartition * domain, for (localIndex n=0 ; ngetElementCenter()[iEle]; @@ -3633,10 +3633,10 @@ int SurfaceGenerator::CalculateElementForcesOnEdge( DomainPartition * domain, realT youngsModulus = 9 * K * G / ( 3 * K + G ); realT poissonRatio = ( 3 * K - 2 * G ) / ( 2 * ( 3 * K + G ) ); - arrayView2d & elementsToNodes = elementSubRegion->nodeList(); + arrayView2d const & elementsToNodes = elementSubRegion->nodeList(); for (localIndex n=0 ; ngetElementCenter()[iEle]; //For C3D6 element type, elementsToNodes map may include repeated indices and the following may run multiple times for the same element. @@ -4109,8 +4109,8 @@ void SurfaceGenerator::PostUpdateRuptureStates( NodeManager & nodeManager, EdgeManager & edgeManager, FaceManager & faceManager, ElementRegionManager & GEOSX_UNUSED_ARG( elementManager ), - array1d >& nodesToRupturedFaces, - array1d >& edgesToRupturedFaces ) + std::vector >& nodesToRupturedFaces, + std::vector >& edgesToRupturedFaces ) { ArrayOfArraysView< localIndex const > const & faceToNodeMap = faceManager.nodeList(); ArrayOfArraysView< localIndex const > const & faceToEdgeMap = faceManager.edgeList(); diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.hpp b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.hpp index 5b493855d2e..2e8c44f7ee9 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.hpp +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.hpp @@ -259,8 +259,8 @@ class SurfaceGenerator : public SolverBase EdgeManager & edgeManager, FaceManager & faceManager, ElementRegionManager & elementManager, - array1d >& nodesToRupturedFaces, - array1d >& edgesToRupturedFaces ); + std::vector >& nodesToRupturedFaces, + std::vector >& edgesToRupturedFaces ); /** * @@ -309,8 +309,8 @@ class SurfaceGenerator : public SolverBase EdgeManager & edgeManager, FaceManager & faceManager, ElementRegionManager & elemManager, - arrayView1d >& nodesToRupturedFaces, - arrayView1d >& edgesToRupturedFaces, + std::vector >& nodesToRupturedFaces, + std::vector >& edgesToRupturedFaces, ElementRegionManager & elementManager, ModifiedObjectLists& modifiedObjects, const bool prefrac ); @@ -335,8 +335,8 @@ class SurfaceGenerator : public SolverBase const EdgeManager & edgeManager, const FaceManager & faceManager, ElementRegionManager & elemManager, - const arrayView1d >& nodesToRupturedFaces, - const arrayView1d >& edgesToRupturedFaces, + const std::vector >& nodesToRupturedFaces, + const std::vector >& edgesToRupturedFaces, std::set& separationPathFaces, map& edgeLocations, map& faceLocations, @@ -364,8 +364,8 @@ class SurfaceGenerator : public SolverBase FaceManager & faceManager, ElementRegionManager & elementManager, ModifiedObjectLists& modifiedObjects, - arrayView1d >& nodesToRupturedFaces, - arrayView1d >& edgesToRupturedFaces, + std::vector >& nodesToRupturedFaces, + std::vector >& edgesToRupturedFaces, const std::set& separationPathFaces, const map& edgeLocations, const map& faceLocations, diff --git a/src/coreComponents/physicsSolvers/unitTests/CMakeLists.txt b/src/coreComponents/physicsSolvers/unitTests/CMakeLists.txt index 6d98ff204ff..e07f66d88d6 100644 --- a/src/coreComponents/physicsSolvers/unitTests/CMakeLists.txt +++ b/src/coreComponents/physicsSolvers/unitTests/CMakeLists.txt @@ -37,7 +37,6 @@ endif() # foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) - message("processing test_name ${test_name}") blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} @@ -55,7 +54,6 @@ endforeach() # #foreach(test ${gtest_geosx_tests_simple}) # get_filename_component( test_name ${test} NAME_WE ) -# message("processing test_name ${test_name}") # blt_add_executable( NAME ${test_name} # SOURCES ${test} # OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} diff --git a/src/coreComponents/physicsSolvers/unitTests/testCompFlowUtils.hpp b/src/coreComponents/physicsSolvers/unitTests/testCompFlowUtils.hpp index 8f97b3f81a8..dd906645153 100644 --- a/src/coreComponents/physicsSolvers/unitTests/testCompFlowUtils.hpp +++ b/src/coreComponents/physicsSolvers/unitTests/testCompFlowUtils.hpp @@ -22,73 +22,89 @@ namespace geosx { -template< typename T, int NDIM > -using Array = LvArray::Array< T, NDIM, localIndex >; - namespace testing { -template< typename T > -void checkDerivative( T valueEps, - T value, - T deriv, - real64 eps, - real64 relTol, +void checkDerivative( real64 const valueEps, + real64 const value, + real64 const deriv, + real64 const eps, + real64 const relTol, + real64 const absTol, string const & name, string const & var ) { - T const numDeriv = ( valueEps - value ) / eps; - checkRelativeError( deriv, numDeriv, relTol, "d(" + name + ")/d(" + var + ")" ); + real64 const numDeriv = (valueEps - value) / eps; + checkRelativeError( deriv, numDeriv, relTol, absTol, "d(" + name + ")/d(" + var + ")" ); } -template< typename T, typename ... Args > -void -checkDerivative( arraySlice1d< T > const & valueEps, - arraySlice1d< T > const & value, - arraySlice1d< T > const & deriv, - real64 eps, - real64 relTol, - string const & name, - string const & var, - string_array const & labels, - Args ... label_lists ) +void checkDerivative( real64 const valueEps, + real64 const value, + real64 const deriv, + real64 const eps, + real64 const relTol, + string const & name, + string const & var ) +{ return checkDerivative( valueEps, value, deriv, eps, relTol, DEFAULT_ABS_TOL, name, var ); } + +void checkDerivative( arraySlice1d< real64 const > const & valueEps, + arraySlice1d< real64 const > const & value, + arraySlice1d< real64 const > const & deriv, + real64 const eps, + real64 const relTol, + real64 const absTol, + string const & name, + string const & var, + string_array const & labels ) { - localIndex const size = labels.size( 0 ); + localIndex const size = labels.size(0); - for( localIndex i = 0; i < size; ++i ) + for (localIndex i = 0; i < size; ++i) { - checkDerivative( valueEps[i], value[i], deriv[i], eps, relTol, - name + "[" + labels[i] + "]", var, label_lists... ); + checkDerivative( valueEps[i], value[i], deriv[i], eps, relTol, absTol, + name + "[" + labels[i] + "]", var ); } } -template< typename T, int DIM, typename ... Args > -typename std::enable_if< ( DIM > 1 ), void >::type -checkDerivative( array_slice< T, DIM > const & valueEps, - array_slice< T, DIM > const & value, - array_slice< T, DIM > const & deriv, - real64 eps, - real64 relTol, - string const & name, - string const & var, - string_array const & labels, - Args ... label_lists ) +template +void checkDerivative( array_slice< real64 const, DIM > const & valueEps, + array_slice< real64 const, DIM > const & value, + array_slice< real64 const, DIM > const & deriv, + real64 const eps, + real64 const relTol, + real64 const absTol, + string const & name, + string const & var, + string_array const & labels, + Args ... label_lists ) { - localIndex const size = labels.size( 0 ); + localIndex const size = labels.size(0); - for( localIndex i = 0; i < size; ++i ) + for (localIndex i = 0; i < size; ++i) { - checkDerivative( valueEps[i], value[i], deriv[i], eps, relTol, + checkDerivative( valueEps[i], value[i], deriv[i], eps, relTol, absTol, name + "[" + labels[i] + "]", var, label_lists... ); } } +template< int DIM, typename ... Args > +void checkDerivative( array_slice< real64 const, DIM > const & valueEps, + array_slice< real64 const, DIM > const & value, + array_slice< real64 const, DIM > const & deriv, + real64 const eps, + real64 const relTol, + string const & name, + string const & var, + string_array const & labels, + Args ... label_lists ) +{ return checkDerivative( valueEps, value, deriv, eps, relTol, DEFAULT_ABS_TOL, name, var, labels, label_lists... ); } + // invert compositional derivative array layout to move innermost slice on the top // (this is needed so we can use checkDerivative() to check derivative w.r.t. for each compositional var) array1d< real64 > invertLayout( arraySlice1d< real64 const > const & input, localIndex N ) { - Array< real64, 1 > output( N ); + array1d< real64 > output( N ); for( int i = 0; i < N; ++i ) { output[i] = input[i]; @@ -101,13 +117,13 @@ array2d< real64 > invertLayout( arraySlice2d< real64 const > const & input, localIndex N1, localIndex N2 ) { - Array< real64, 2 > output( N2, N1 ); + array2d< real64 > output( N2, N1 ); for( localIndex i = 0; i < N1; ++i ) { for( localIndex j = 0; j < N2; ++j ) { - output[j][i] = input[i][j]; + output(j, i) = input(i, j); } } @@ -119,7 +135,7 @@ array3d< real64 > invertLayout( arraySlice3d< real64 const > const & input, localIndex N2, localIndex N3 ) { - Array< real64, 3 > output( N3, N1, N2 ); + array3d< real64 > output( N3, N1, N2 ); for( localIndex i = 0; i < N1; ++i ) { @@ -127,7 +143,7 @@ array3d< real64 > invertLayout( arraySlice3d< real64 const > const & input, { for( localIndex k = 0; k < N3; ++k ) { - output[k][i][j] = input[i][j][k]; + output(k, i, j) = input(i, j, k); } } } diff --git a/src/coreComponents/physicsSolvers/unitTests/testCompMultiphaseFlow.cpp b/src/coreComponents/physicsSolvers/unitTests/testCompMultiphaseFlow.cpp index 0379591319c..c24204ee438 100644 --- a/src/coreComponents/physicsSolvers/unitTests/testCompMultiphaseFlow.cpp +++ b/src/coreComponents/physicsSolvers/unitTests/testCompMultiphaseFlow.cpp @@ -253,8 +253,14 @@ void testCompositionNumericalDerivatives( CompositionalMultiphaseFlow * solver, auto dZ_dRho = invertLayout( dCompFrac_dCompDens[ei], NC, NC ); string var = "compDens[" + components[jc] + "]"; - checkDerivative( compFrac[ei], compFracOrig[ei], dZ_dRho[jc], dCompDens[ei][jc], relTol, - "compFrac", var, components ); + checkDerivative( compFrac[ei].toSliceConst(), + compFracOrig[ei].toSliceConst(), + dZ_dRho[jc].toSliceConst(), + dCompDens[ei][jc], + relTol, + "compFrac", + var, + components ); } } } ); @@ -336,8 +342,14 @@ void testPhaseVolumeFractionNumericalDerivatives( CompositionalMultiphaseFlow * { SCOPED_TRACE( "Element " + std::to_string(ei) ); - checkDerivative( phaseVolFrac[ei], phaseVolFracOrig[ei], dPhaseVolFrac_dPres[ei], dPres[ei], relTol, - "phaseVolFrac", "Pres", phases ); + checkDerivative( phaseVolFrac[ei].toSliceConst(), + phaseVolFracOrig[ei].toSliceConst(), + dPhaseVolFrac_dPres[ei].toSliceConst(), + dPres[ei], + relTol, + "phaseVolFrac", + "Pres", + phases ); } } @@ -365,8 +377,14 @@ void testPhaseVolumeFractionNumericalDerivatives( CompositionalMultiphaseFlow * auto dS_dRho = invertLayout( dPhaseVolFrac_dCompDens[ei], NP, NC ); string var = "compDens[" + components[jc] + "]"; - checkDerivative( phaseVolFrac[ei], phaseVolFracOrig[ei], dS_dRho[jc], dCompDens[ei][jc], relTol, - "phaseVolFrac", var, phases ); + checkDerivative( phaseVolFrac[ei].toSliceConst(), + phaseVolFracOrig[ei].toSliceConst(), + dS_dRho[jc].toSliceConst(), + dCompDens[ei][jc], + relTol, + "phaseVolFrac", + var, + phases ); } } } ); @@ -447,8 +465,14 @@ void testPhaseMobilityNumericalDerivatives( CompositionalMultiphaseFlow * solver { SCOPED_TRACE( "Element " + std::to_string(ei) ); - checkDerivative( phaseMob[ei], phaseVolFracOrig[ei], dPhaseMob_dPres[ei], dPres[ei], relTol, - "phaseVolFrac", "Pres", phases ); + checkDerivative( phaseMob[ei].toSliceConst(), + phaseVolFracOrig[ei].toSliceConst(), + dPhaseMob_dPres[ei].toSliceConst(), + dPres[ei], + relTol, + "phaseVolFrac", + "Pres", + phases ); } } @@ -476,8 +500,14 @@ void testPhaseMobilityNumericalDerivatives( CompositionalMultiphaseFlow * solver auto dS_dRho = invertLayout( dPhaseMob_dCompDens[ei], NP, NC ); string var = "compDens[" + components[jc] + "]"; - checkDerivative( phaseMob[ei], phaseVolFracOrig[ei], dS_dRho[jc], dCompDens[ei][jc], relTol, - "phaseMob", var, phases ); + checkDerivative( phaseMob[ei].toSliceConst(), + phaseVolFracOrig[ei].toSliceConst(), + dS_dRho[jc].toSliceConst(), + dCompDens[ei][jc], + relTol, + "phaseMob", + var, + phases ); } } } ); diff --git a/src/coreComponents/physicsSolvers/unitTests/testFlowKernelHelpers.hpp b/src/coreComponents/physicsSolvers/unitTests/testFlowKernelHelpers.hpp index 7206ededc4d..b58df762b70 100644 --- a/src/coreComponents/physicsSolvers/unitTests/testFlowKernelHelpers.hpp +++ b/src/coreComponents/physicsSolvers/unitTests/testFlowKernelHelpers.hpp @@ -19,17 +19,11 @@ //using namespace geosx; -template -using Array = LvArray::Array; - -template -using ArrayView = LvArray::ArrayView; - namespace detail { template -void setArrayElement( ArrayView const & arr, +void setArrayElement( array_view const & arr, localIndex const dstIndex, localIndex const srcIndex, T const * const data ) @@ -59,10 +53,10 @@ template<> struct AccessorHelper { template - using ElementAccessor = Array; + using ElementAccessor = array_decl; template - using MaterialAccessor = Array; + using MaterialAccessor = array_decl; template static ElementAccessor @@ -120,10 +114,10 @@ template<> struct AccessorHelper { template - using ElementAccessor = ElementRegionManager::ElementViewAccessor>; + using ElementAccessor = ElementRegionManager::ElementViewAccessor>; template - using MaterialAccessor = ElementRegionManager::MaterialViewAccessor>; + using MaterialAccessor = ElementRegionManager::MaterialViewAccessor>; template static ElementAccessor diff --git a/src/coreComponents/physicsSolvers/unitTests/testReservoirCompositionalMultiphaseMSWells.cpp b/src/coreComponents/physicsSolvers/unitTests/testReservoirCompositionalMultiphaseMSWells.cpp index 4b7c221cc4e..fd153c9c9a5 100644 --- a/src/coreComponents/physicsSolvers/unitTests/testReservoirCompositionalMultiphaseMSWells.cpp +++ b/src/coreComponents/physicsSolvers/unitTests/testReservoirCompositionalMultiphaseMSWells.cpp @@ -315,7 +315,7 @@ void testNumericalJacobian( ReservoirSolver * solver, { // get the degrees of freedom, ghosting info and next well elem index - array1d const & wellElemDofNumber = + arrayView1d const & wellElemDofNumber = subRegion->getReference>( wellDofKey ); arrayView1d const & wellElemGhostRank = diff --git a/src/coreComponents/physicsSolvers/unitTests/testReservoirSinglePhaseMSWells.cpp b/src/coreComponents/physicsSolvers/unitTests/testReservoirSinglePhaseMSWells.cpp index f62e01a1e87..e30e9d31995 100644 --- a/src/coreComponents/physicsSolvers/unitTests/testReservoirSinglePhaseMSWells.cpp +++ b/src/coreComponents/physicsSolvers/unitTests/testReservoirSinglePhaseMSWells.cpp @@ -159,7 +159,7 @@ void testNumericalJacobian( ReservoirSolver * solver, { // get the degrees of freedom and ghosting information - array1d const & wellElemDofNumber = + arrayView1d const & wellElemDofNumber = subRegion->getReference>( wellDofKey ); arrayView1d const & wellElemGhostRank = diff --git a/src/coreComponents/physicsSolvers/unitTests/testSinglePhaseFlowKernels.cpp b/src/coreComponents/physicsSolvers/unitTests/testSinglePhaseFlowKernels.cpp index 18515746395..60553d2e90c 100644 --- a/src/coreComponents/physicsSolvers/unitTests/testSinglePhaseFlowKernels.cpp +++ b/src/coreComponents/physicsSolvers/unitTests/testSinglePhaseFlowKernels.cpp @@ -97,12 +97,6 @@ TEST( SinglePhaseFlowKernels, accumulation ) } } -template -using Array = LvArray::Array; - -template -using ArrayView = LvArray::ArrayView; - template void computeFlux( arraySlice1d const & weight, real64 const * pres, diff --git a/src/coreComponents/rajaInterface/GEOS_RAJA_Interface.hpp b/src/coreComponents/rajaInterface/GEOS_RAJA_Interface.hpp index a38a856aa43..3c754bd4782 100644 --- a/src/coreComponents/rajaInterface/GEOS_RAJA_Interface.hpp +++ b/src/coreComponents/rajaInterface/GEOS_RAJA_Interface.hpp @@ -72,61 +72,17 @@ RAJA_INLINE void forall_in_set(const T * const indexList, const localIndex len, RAJA::forall(RAJA::TypedListSegment(indexList, len, RAJA::Unowned), std::forward(body)); } -template< typename T , typename atomicPol=RAJA::auto_atomic> -inline void AddLocalToGlobal( arraySlice1d const & globalToLocalRelation, - arraySlice1d< T const > const & localField, - arraySlice1d< T const >& globalField, - localIndex const N ) -{ - for( localIndex a=0 ; a( &globalField[ globalToLocalRelation[a] ], localField[a] ); - } -} - -template< typename atomicPol=RAJA::auto_atomic> -inline void AddLocalToGlobal( arraySlice1d const & globalToLocalRelation, - arraySlice1d const & localField, - arraySlice1d& globalField, - localIndex const N ) -{ - for( localIndex a=0 ; a( &gData[0], lData[0] ); - RAJA::atomicAdd( &gData[1], lData[1] ); - RAJA::atomicAdd( &gData[2], lData[2] ); - } -} - -template< localIndex N, typename atomicPol=RAJA::auto_atomic> -inline void AddLocalToGlobal( arraySlice1d const & globalToLocalRelation, +template< localIndex N, typename atomicPol=RAJA::auto_atomic, int UNIT_STRIDE_DIM > +inline void AddLocalToGlobal( arraySlice1d< localIndex const, UNIT_STRIDE_DIM > const & globalToLocalRelation, R1Tensor const * const restrict localField, - arraySlice1d & globalField ) -{ - for( localIndex a=0 ; a( &gData[0], lData[0] ); - RAJA::atomicAdd( &gData[1], lData[1] ); - RAJA::atomicAdd( &gData[2], lData[2] ); - } -} - -template< typename T, typename atomicPol=RAJA::auto_atomic > -inline void AddLocalToGlobal( arraySlice1d const & globalToLocalRelation, - arraySlice1d< T const > const & localField1, - arraySlice1d< T const > const & localField2, - arraySlice1d< T > & globalField1, - arraySlice1d< T > & globalField2, - localIndex const N ) + arrayView1d< R1Tensor > const & globalField ) { - for( localIndex a=0 ; a( &globalField1[ globalToLocalRelation[a] ], localField1[a] ); - RAJA::atomicAdd( &globalField2[ globalToLocalRelation[a] ], localField2[a] ); + localIndex const i = globalToLocalRelation[ a ]; + RAJA::atomicAdd( &globalField[ i ][ 0 ], localField[ a ][ 0 ] ); + RAJA::atomicAdd( &globalField[ i ][ 1 ], localField[ a ][ 1 ] ); + RAJA::atomicAdd( &globalField[ i ][ 2 ], localField[ a ][ 2 ] ); } } diff --git a/src/coreComponents/wells/InternalWellGenerator.hpp b/src/coreComponents/wells/InternalWellGenerator.hpp index 923e3a3ce9e..83e86e72ae9 100644 --- a/src/coreComponents/wells/InternalWellGenerator.hpp +++ b/src/coreComponents/wells/InternalWellGenerator.hpp @@ -106,31 +106,31 @@ class InternalWellGenerator : public MeshGeneratorBase * @brief Getter for the physical location of the centers of well elements * @return list of center locations of the well elements */ - array1d const & GetElemCoords() const { return m_elemCenterCoords; } + arrayView1d const & GetElemCoords() const { return m_elemCenterCoords; } /** * @brief Getter for the global indices mapping an element to the next * @return list providing the global index of the next element for each element */ - array1d const & GetNextElemIndex() const { return m_nextElemId; } + arrayView1d const & GetNextElemIndex() const { return m_nextElemId; } /** * @brief Getter for the global indices mapping an element to the previous ones * @return list providing the global indices of the previous elements for each element */ - array1d< array1d const> const & GetPrevElemIndices() const { return m_prevElemId; } + arrayView1d< arrayView1d const> const & GetPrevElemIndices() const { return m_prevElemId.toViewConst(); } /** * @brief Getter for the global indices of the well nodes nodes connected to each element * @return list providing the global index of the well nodes for each well element */ - array2d const & GetElemToNodesMap() const { return m_elemToNodesMap; } + arrayView2d const & GetElemToNodesMap() const { return m_elemToNodesMap; } /** * @brief Getter for the volume of the well elements * @return list of volumes of the well elements */ - array1d const & GetElemVolume() const { return m_elemVolume; } + arrayView1d const & GetElemVolume() const { return m_elemVolume; } // getters for node data @@ -145,7 +145,7 @@ class InternalWellGenerator : public MeshGeneratorBase * @brief Getter for the physical location of the centers of well elements * @return list of center locations of the well elements */ - array1d const & GetNodeCoords() const { return m_nodeCoords; } + arrayView1d const & GetNodeCoords() const { return m_nodeCoords; } @@ -161,19 +161,19 @@ class InternalWellGenerator : public MeshGeneratorBase * @brief Getter for the locations of the perforations * @return list of locations of all the perforations on the well */ - array1d const & GetPerfCoords() const { return m_perfCoords; } + arrayView1d const & GetPerfCoords() const { return m_perfCoords; } /** * @brief Getter for the transmissibility at the perforations * @return list of transmissibilities at all the perforations on the well */ - array1d const & GetPerfTransmissibility() const { return m_perfTrans; } + arrayView1d const & GetPerfTransmissibility() const { return m_perfTrans; } /** * @brief Getter for the global indices of the well elements connected to each perforation * @return list providing the global index of the connected well element for each perforation */ - array1d const & GetPerfElemIndex() const { return m_perfElemId; } + arrayView1d const & GetPerfElemIndex() const { return m_perfElemId; } diff --git a/src/coreComponents/wells/PerforationData.cpp b/src/coreComponents/wells/PerforationData.cpp index f0dd3d0cbbb..317acc9d22a 100644 --- a/src/coreComponents/wells/PerforationData.cpp +++ b/src/coreComponents/wells/PerforationData.cpp @@ -61,8 +61,8 @@ void PerforationData::ConnectToMeshElements( MeshLevel const & mesh, viewKeyStruct:: elementCenterString ); - array1d const & perfCoordsGlobal = wellGeometry.GetPerfCoords(); - array1d const & perfTransGlobal = wellGeometry.GetPerfTransmissibility(); + arrayView1d const & perfCoordsGlobal = wellGeometry.GetPerfCoords(); + arrayView1d const & perfTransGlobal = wellGeometry.GetPerfTransmissibility(); resize( perfCoordsGlobal.size() ); localIndex iperfLocal = 0; @@ -133,7 +133,7 @@ void PerforationData::ConnectToWellElements( InternalWellGenerator const & wellG unordered_map const & globalToLocalWellElemMap, globalIndex elemOffsetGlobal ) { - array1d const & perfElemIndexGlobal = wellGeometry.GetPerfElemIndex(); + arrayView1d const & perfElemIndexGlobal = wellGeometry.GetPerfElemIndex(); for (localIndex iperfLocal = 0; iperfLocal < size(); ++iperfLocal) { diff --git a/src/coreComponents/wells/WellElementRegion.cpp b/src/coreComponents/wells/WellElementRegion.cpp index 0cbec6eff19..b4bf6a7708d 100644 --- a/src/coreComponents/wells/WellElementRegion.cpp +++ b/src/coreComponents/wells/WellElementRegion.cpp @@ -76,7 +76,7 @@ void WellElementRegion::GenerateWell( MeshLevel & mesh, array1d elemStatusGlobal( numElemsGlobal ); elemStatusGlobal = WellElementSubRegion::WellElemStatus::UNOWNED; - array1d const & perfElemIdGlobal = wellGeometry.GetPerfElemIndex(); + arrayView1d const & perfElemIdGlobal = wellGeometry.GetPerfElemIndex(); for (localIndex iperfGlobal = 0; iperfGlobal < numPerforationsGlobal; ++iperfGlobal) { diff --git a/src/coreComponents/wells/WellElementSubRegion.cpp b/src/coreComponents/wells/WellElementSubRegion.cpp index 54b8e1899a7..c6fee0bece3 100644 --- a/src/coreComponents/wells/WellElementSubRegion.cpp +++ b/src/coreComponents/wells/WellElementSubRegion.cpp @@ -27,6 +27,7 @@ namespace geosx WellElementSubRegion::WellElementSubRegion( string const & name, Group * const parent ): ElementSubRegionBase( name, parent ), m_wellControlsName(""), + m_toNodesRelation(), m_topWellElementIndex( -1 ), m_perforationData( groupKeyStruct::perforationDataString, this ), m_topRank( -1 ) @@ -223,7 +224,7 @@ void WellElementSubRegion::CheckPartitioningValidity( InternalWellGenerator cons set & localElems, arrayView1d & elemStatusGlobal ) const { - array1d< array1d const > const & prevElemIdsGlobal = wellGeometry.GetPrevElemIndices(); + arrayView1d< arrayView1d< globalIndex const > const > const & prevElemIdsGlobal = wellGeometry.GetPrevElemIndices(); // we are going to make sure that the partitioning is good, // well element per well element, starting from the bottom of the well @@ -319,9 +320,9 @@ void WellElementSubRegion::CollectLocalAndBoundaryNodes( InternalWellGenerator c set & boundaryNodes ) const { // get the well connectivity - arrayView1d const & nextElemIdGlobal = wellGeometry.GetNextElemIndex(); - array1d< array1d const > const & prevElemIdsGlobal = wellGeometry.GetPrevElemIndices(); - arrayView2d const & elemToNodesGlobal = wellGeometry.GetElemToNodesMap(); + arrayView1d< globalIndex const > const & nextElemIdGlobal = wellGeometry.GetNextElemIndex(); + arrayView1d< arrayView1d< globalIndex const > const > const & prevElemIdsGlobal = wellGeometry.GetPrevElemIndices(); + arrayView2d< globalIndex const > const & elemToNodesGlobal = wellGeometry.GetElemToNodesMap(); // loop over the local elements and collect the local and boundary nodes for (globalIndex currGlobal : localElems) @@ -336,13 +337,13 @@ void WellElementSubRegion::CollectLocalAndBoundaryNodes( InternalWellGenerator c localIndex const nextGlobal = integer_conversion( nextElemIdGlobal[ integer_conversion(currGlobal) ] ); - // if the next well elem is not local, add the node in betweem curr and next to boundaryNodes + // if the next well elem is not local, add the node in between curr and next to boundaryNodes if (nextGlobal >= 0 && !localElems.contains( nextGlobal )) { boundaryNodes.insert( inodeTopGlobal ); } - // if the prev well elem is not local, add the node in betweem curr and prev to boundaryNodes (relevant for branches) + // if the prev well elem is not local, add the node in between curr and prev to boundaryNodes (relevant for branches) for (localIndex iwelem = 0; iwelem < prevElemIdsGlobal[currGlobal].size(); ++iwelem) { globalIndex const prevGlobal = prevElemIdsGlobal[currGlobal][iwelem]; @@ -573,7 +574,7 @@ localIndex WellElementSubRegion::PackUpDownMapsPrivate( buffer_unit_type * & buf localIndex packedSize = 0; packedSize += bufferOps::Pack( buffer, - nodeList().Base(), + nodeList().Base().toViewConst(), m_unmappedGlobalIndicesInNodelist, packList, this->m_localToGlobalMap, @@ -590,7 +591,7 @@ localIndex WellElementSubRegion::UnpackUpDownMaps( buffer_unit_type const * & bu localIndex unPackedSize = 0; unPackedSize += bufferOps::Unpack( buffer, - nodeList().Base(), + nodeList().Base().toView(), packList, m_unmappedGlobalIndicesInNodelist, this->m_globalToLocalMap, diff --git a/src/coreComponents/wells/WellElementSubRegion.hpp b/src/coreComponents/wells/WellElementSubRegion.hpp index 9169082747f..1ae5d4dc04f 100644 --- a/src/coreComponents/wells/WellElementSubRegion.hpp +++ b/src/coreComponents/wells/WellElementSubRegion.hpp @@ -31,7 +31,15 @@ class WellElementSubRegion : public ElementSubRegionBase { public: - using NodeMapType=FixedOneToManyRelation; +#if defined( GEOSX_USE_CUDA ) + using NODE_MAP_PERMUTATION = RAJA::PERM_JI; +#else + using NODE_MAP_PERMUTATION = RAJA::PERM_IJ; +#endif + + static constexpr int NODE_MAP_UNIT_STRIDE_DIM = LvArray::getStrideOneDimension( NODE_MAP_PERMUTATION {} ); + + using NodeMapType = InterObjectRelation< array2d< localIndex, NODE_MAP_PERMUTATION > >; using EdgeMapType=FixedOneToManyRelation; // unused but needed in MeshLevel::GenerateAdjacencyLists using FaceMapType=FixedOneToManyRelation; // unused but needed in MeshLevel::GenerateAdjacencyLists @@ -118,7 +126,7 @@ class WellElementSubRegion : public ElementSubRegionBase /** * @return the element to node map */ - FixedOneToManyRelation & nodeList() + NodeMapType & nodeList() { return m_toNodesRelation; } @@ -126,29 +134,11 @@ class WellElementSubRegion : public ElementSubRegionBase /** * @return the element to node map */ - FixedOneToManyRelation const & nodeList() const + NodeMapType const & nodeList() const { return m_toNodesRelation; } - /** - * @brief returns the element to node relations. - * @param[in] k the index of the element. - */ - virtual arraySlice1dRval nodeList( localIndex const k ) const override - { - return m_toNodesRelation[k]; - } - - /** - * @brief returns the element to node relations. - * @param[in] k the index of the element. - */ - virtual arraySlice1dRval nodeList( localIndex const k ) override - { - return m_toNodesRelation[k]; - } - /** * @brief Getter for the top element index * @return local index of well's top element or -1 if it is not on current rank From 585bb37f7bee0b16e57be603995c4efb68ab48a0 Mon Sep 17 00:00:00 2001 From: Benjamin Curtice Corbett Date: Fri, 1 Nov 2019 16:37:15 -0700 Subject: [PATCH 2/5] Using conduit directly for restart. --- integratedTests | 2 +- .../codingUtilities/GeosxTraits.hpp | 227 +++--- .../codingUtilities/tests/testGeosxTraits.cpp | 234 ++++-- src/coreComponents/common/DataTypes.hpp | 152 ++-- .../constitutive/Fluid/MultiFluidBase.hpp | 20 +- .../constitutive/unitTests/testMultiFluid.cpp | 2 +- src/coreComponents/cxx-utilities | 2 +- .../dataRepository/BufferOps.hpp | 224 ++++-- .../dataRepository/BufferOps_inline.hpp | 168 ++-- .../dataRepository/CMakeLists.txt | 1 + .../dataRepository/DefaultValue.hpp | 1 + src/coreComponents/dataRepository/Group.cpp | 119 +-- src/coreComponents/dataRepository/Group.hpp | 111 +-- .../dataRepository/SidreWrapper.cpp | 114 ++- .../dataRepository/SidreWrapper.hpp | 72 +- src/coreComponents/dataRepository/Wrapper.hpp | 719 ++---------------- .../dataRepository/WrapperBase.cpp | 36 +- .../dataRepository/WrapperBase.hpp | 99 +-- .../dataRepository/WrapperHelpers.hpp | 408 ++++++++++ .../dataRepository/unitTests/CMakeLists.txt | 1 + .../unitTests/testBufferOps.cpp | 54 ++ .../unitTests/testDefaultValue.cpp | 12 +- .../unitTests/testSidreBasic.cpp | 290 +++++-- .../unitTests/testSidreExtended.cpp | 52 +- .../dataRepository/xmlWrapper.hpp | 4 +- src/coreComponents/fileIO/CMakeLists.txt | 24 +- .../fileIO/blueprint/Blueprint.cpp | 226 ------ .../fileIO/blueprint/Blueprint.hpp | 73 -- .../schema/docs/BlackOilFluid_other.rst | 48 +- ...ksCoreyBakerRelativePermeability_other.rst | 14 +- .../BrooksCoreyCapillaryPressure_other.rst | 16 +- .../BrooksCoreyRelativePermeability_other.rst | 14 +- .../CompositionalMultiphaseFluid_other.rst | 48 +- .../docs/LinearElasticAnisotropic_other.rst | 18 +- .../fileIO/schema/docs/Outputs.rst | 17 +- .../fileIO/schema/docs/Outputs_other.rst | 17 +- .../PoroLinearElasticAnisotropic_other.rst | 22 +- ...nuchtenBakerRelativePermeability_other.rst | 14 +- .../VanGenuchtenCapillaryPressure_other.rst | 16 +- ...WellElementRegionuniqueSubRegion_other.rst | 42 +- .../fileIO/schema/docs/default_other.rst | 44 +- .../fileIO/schema/docs/domain_other.rst | 18 +- .../fileIO/schema/docs/edgeManager_other.rst | 42 +- src/coreComponents/fileIO/schema/schema.xsd | 9 - .../fileIO/schema/schema.xsd.other | 56 +- src/coreComponents/fileIO/utils/utils.hpp | 46 +- src/coreComponents/fileIO/vtk/VTKFile.cpp | 6 +- src/coreComponents/managers/CMakeLists.txt | 2 - .../managers/ObjectManagerBase.cpp | 5 +- .../managers/Outputs/BlueprintOutput.cpp | 59 -- .../managers/Outputs/BlueprintOutput.hpp | 75 -- .../managers/Outputs/RestartOutput.cpp | 5 +- .../managers/ProblemManager.cpp | 10 +- .../managers/ProblemManager.hpp | 2 +- .../testRecursiveFieldApplication.cpp | 43 +- src/coreComponents/mesh/BufferOps.cpp | 16 +- src/coreComponents/mesh/BufferOps.hpp | 8 +- .../meshUtilities/VTMMeshGenerator.cpp | 4 +- .../mpiCommunications/CommunicationTools.cpp | 5 +- .../mpiCommunications/MpiWrapper.hpp | 26 +- .../NeighborCommunicator.cpp | 8 +- .../NeighborCommunicator.hpp | 10 +- .../surfaceGeneration/SurfaceGenerator.cpp | 12 +- .../unitTests/testCompFlowUtils.hpp | 12 +- .../unitTests/testCompMultiphaseFlow.cpp | 6 +- .../testCompMultiphaseFlowCapPressure.cpp | 6 +- .../unitTests/testFlowKernelHelpers.hpp | 10 +- ...eservoirCompositionalMultiphaseMSWells.cpp | 6 +- .../testReservoirSinglePhaseMSWells.cpp | 6 +- .../wells/WellElementSubRegion.hpp | 4 +- src/docs/sphinx/CompleteXMLSchema.rst | 14 - src/main/main.cpp | 10 +- 72 files changed, 1947 insertions(+), 2371 deletions(-) create mode 100644 src/coreComponents/dataRepository/WrapperHelpers.hpp create mode 100644 src/coreComponents/dataRepository/unitTests/testBufferOps.cpp delete mode 100644 src/coreComponents/fileIO/blueprint/Blueprint.cpp delete mode 100644 src/coreComponents/fileIO/blueprint/Blueprint.hpp delete mode 100644 src/coreComponents/managers/Outputs/BlueprintOutput.cpp delete mode 100644 src/coreComponents/managers/Outputs/BlueprintOutput.hpp diff --git a/integratedTests b/integratedTests index 732dca816a2..a15049a1290 160000 --- a/integratedTests +++ b/integratedTests @@ -1 +1 @@ -Subproject commit 732dca816a2683a7af5f74422a903e0c8d05e885 +Subproject commit a15049a1290fd13062feb04e48c25b0229d2dcf2 diff --git a/src/coreComponents/codingUtilities/GeosxTraits.hpp b/src/coreComponents/codingUtilities/GeosxTraits.hpp index fb5c14c361a..401250bddac 100644 --- a/src/coreComponents/codingUtilities/GeosxTraits.hpp +++ b/src/coreComponents/codingUtilities/GeosxTraits.hpp @@ -29,119 +29,174 @@ namespace geosx namespace traits { -template -constexpr bool is_string = is_instance_of_v; - -template -constexpr bool is_std_vector = is_instantiation_of_v; - -template -constexpr bool is_pair = is_instantiation_of_v; - -template -constexpr bool is_map = is_instantiation_of_v; - -template -constexpr bool is_set = is_instantiation_of_v; - -template -constexpr bool is_array = false; - -template< typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE > -constexpr bool is_array< LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > > = true; - -template -constexpr bool is_tensorT = is_instance_of_v || - is_instance_of_v || - is_instance_of_v; - -} /* namespace traits */ - - - -namespace bufferOps +namespace internal { + HAS_ALIAS( value_type ) + + HAS_ALIAS( pointer ) + + template< class T, + bool HASPOINTERTYPE = has_alias_pointer< T >::value > + struct PointerHelper + { + using Pointer = T *; + using ConstPointer = T const *; + }; + + template< class T > + struct PointerHelper< T, true > + { + using Pointer = typename T::pointer; + using ConstPointer = typename T::const_pointer; + }; + + template< typename T > + struct has_data_method + { + HAS_MEMBER_FUNCTION_VARIANT( data, nonconst, typename PointerHelper< T >::Pointer, , , ) + HAS_MEMBER_FUNCTION_VARIANT( data, const, typename PointerHelper< T >::Pointer, const, , ) + + static constexpr bool value = has_memberfunction_vnonconst_data< T >::value || + has_memberfunction_vconst_data< T >::value; + }; + + template< typename T > + struct has_chai_move_method + { + HAS_MEMBER_FUNCTION( move, + void, + , + VA_LIST( chai::ExecutionSpace, bool ), + VA_LIST( chai::CPU, true ) ) + static constexpr bool value = has_memberfunction_move< T >::value; + }; + + template< typename T > + struct has_empty_method + { + HAS_MEMBER_FUNCTION( empty, bool, const, , ) + static constexpr bool value = has_memberfunction_empty< T >::value; + }; + + template< typename T, typename INDEX_TYPE > + struct has_size_method + { + HAS_MEMBER_FUNCTION( size, INDEX_TYPE, const, , ) + static constexpr bool value = has_memberfunction_size< T >::value; + }; + + template< typename T, typename INDEX_TYPE > + struct has_dimension_size_method + { + HAS_MEMBER_FUNCTION( size, INDEX_TYPE, const, VA_LIST( int ), VA_LIST( 0 ) ) + static constexpr bool value = has_memberfunction_size< T >::value; + }; + + template< typename T, typename INDEX_TYPE > + struct has_resize_method + { + HAS_MEMBER_FUNCTION( resize, void, , VA_LIST( INDEX_TYPE ), VA_LIST( INDEX_TYPE( 0 ) ) ) + static constexpr bool value = has_memberfunction_resize< T >::value; + }; + + template< typename T, typename DVT, typename INDEX_TYPE > + struct has_resize_default_method + { + HAS_MEMBER_FUNCTION( resizeDefault, void, , VA_LIST( INDEX_TYPE, DVT const & ), VA_LIST( INDEX_TYPE( 0 ), std::declval< DVT const & >() ) ) + static constexpr bool value = has_memberfunction_resizeDefault< T >::value; + }; + + template< typename T > + struct has_resize_dimensions_method + { + HAS_MEMBER_FUNCTION( resize, void, , VA_LIST( int, localIndex const * ), + VA_LIST( 0, static_cast< localIndex const * >( nullptr ) ) ) + static constexpr bool value = has_memberfunction_resize< T >::value; + }; + + +} // namespace internal -/* Forward declaration of is_packable */ template< typename T > -struct is_packable; - +using Pointer = typename internal::PointerHelper< T >::Pointer; template< typename T > -struct is_noncontainer_type_packable -{ - static constexpr bool value = std::is_trivial::value || - std::is_arithmetic::value || - traits::is_tensorT || - traits::is_string; -}; -template< typename T > -constexpr bool is_noncontainer_type_packable::value; - -template -struct is_packable_array : std::false_type {}; +using ConstPointer = typename internal::PointerHelper< T >::ConstPointer; -template -struct is_packable_array< LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > > : is_packable {}; +template< typename T > +constexpr bool has_alias_value_type = internal::has_alias_value_type< T >::value; -template -struct is_packable_array< LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > > : is_packable {}; +template< typename T > +constexpr bool has_data_method = internal::has_data_method< T >::value; -template -struct is_packable_array< LvArray::ArraySlice< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > > : is_packable {}; +template< typename T > +constexpr bool has_chai_move_method = internal::has_chai_move_method< T >::value; -template -struct is_packable_array< LvArray::ArrayOfArrays > : is_packable {}; +template< typename T > +constexpr bool has_empty_method = internal::has_empty_method< T >::value; +template< typename T > +constexpr bool has_size_method = internal::has_size_method< T, int >::value || + internal::has_size_method< T, unsigned int >::value || + internal::has_size_method< T, long >::value || + internal::has_size_method< T, unsigned long >::value || + internal::has_size_method< T, long long >::value || + internal::has_size_method< T, unsigned long long >::value; -template -struct is_packable_set : std::false_type {}; +template< typename T > +constexpr bool has_dimension_size_method = internal::has_dimension_size_method< T, int >::value || + internal::has_dimension_size_method< T, unsigned int >::value || + internal::has_dimension_size_method< T, long >::value || + internal::has_dimension_size_method< T, unsigned long >::value || + internal::has_dimension_size_method< T, long long >::value || + internal::has_dimension_size_method< T, unsigned long long >::value; template< typename T > -struct is_packable_set< set > -{ - static constexpr bool value = is_packable::value; -}; -template< typename T> -constexpr bool is_packable_set< set >::value; +constexpr bool has_resize_method = internal::has_resize_method< T, int >::value || + internal::has_resize_method< T, unsigned int >::value || + internal::has_resize_method< T, long >::value || + internal::has_resize_method< T, unsigned long >::value || + internal::has_resize_method< T, long long >::value || + internal::has_resize_method< T, unsigned long long >::value; + +template< typename T, typename DVT > +constexpr bool has_resize_default_method = internal::has_resize_default_method< T, DVT, int >::value || + internal::has_resize_default_method< T, DVT, unsigned int >::value || + internal::has_resize_default_method< T, DVT, long >::value || + internal::has_resize_default_method< T, DVT, unsigned long >::value || + internal::has_resize_default_method< T, DVT, long long >::value || + internal::has_resize_default_method< T, DVT, unsigned long long >::value; +template< typename T > +constexpr bool has_resize_default_method< T, void > = false; -template -struct is_packable_map : std::false_type {}; +template< typename T > +constexpr bool has_resize_dimensions_method = internal::has_resize_dimensions_method< T >::value; -template -struct is_packable_map< mapBase > -{ - static constexpr bool value = is_packable::value && - is_packable::value; -}; -template< typename T_KEY, typename T_VAL, typename SORTED> -constexpr bool is_packable_map< mapBase >::value; +template< typename T > +constexpr bool is_string = is_instance_of_v< std::string, T >; +template< typename T > +constexpr bool is_std_vector = is_instantiation_of_v< std::vector, T >; template< typename T > -struct is_packable -{ - static constexpr bool value = is_noncontainer_type_packable::value || - is_packable_array::value || - is_packable_map::value || - is_packable_set::value ; +constexpr bool is_pair = is_instantiation_of_v< std::pair, T >; -}; template< typename T > -constexpr bool is_packable::value; +constexpr bool is_map = is_instantiation_of_v< mapBase, T >; +template< typename T > +constexpr bool is_set = is_instantiation_of_v< LvArray::SortedArray, T >; template< typename T > -struct is_packable_by_index -{ - static constexpr bool value = is_packable_array::value ; +constexpr bool is_array = LvArray::detail::is_array< T >::value; -}; template< typename T > -constexpr bool is_packable_by_index::value; +constexpr bool is_tensorT = is_instance_of_v< R1Tensor, T > || + is_instance_of_v< R2Tensor, T > || + is_instance_of_v< R2SymTensor, T >; -} /* namespace bufferOps */ +} /* namespace traits */ template struct add_const_if diff --git a/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp b/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp index 936e1ba433d..e79e5ca643a 100644 --- a/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp +++ b/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp @@ -12,114 +12,212 @@ * ------------------------------------------------------------------------------------------------------------ */ -#include - +// Source includes #include "codingUtilities/GeosxTraits.hpp" +// TPL includes +#include + using namespace geosx; using namespace geosx::traits; -using namespace bufferOps; -TEST(testGeosxTraits,test_is_tensorT) +TEST( testGeosxTraits, Pointer ) { - static_assert(is_tensorT, "Should be true"); - static_assert(is_tensorT, "Should be true"); - static_assert(is_tensorT, "Should be true"); - - static_assert(!is_tensorT, "Should be false"); - static_assert(!is_tensorT, "Should be false"); - static_assert(!is_tensorT, "Should be false"); + static_assert( std::is_same< Pointer< int >, int * >::value, "Should be true." ); + static_assert( std::is_same< Pointer< R1Tensor >, R1Tensor * >::value, "Should be true." ); + static_assert( std::is_same< Pointer< std::vector< double > >, double * >::value, "Should be true." ); + static_assert( std::is_same< Pointer< std::string >, char * >::value, "Should be true." ); + static_assert( std::is_same< Pointer< array3d< std::string > >, std::string * >::value, "Should be true." ); + static_assert( std::is_same< Pointer< SortedArray< float > >, float const * >::value, "Should be true." ); + + static_assert( std::is_same< ConstPointer< int >, int const * >::value, "Should be true." ); + static_assert( std::is_same< ConstPointer< R1Tensor >, R1Tensor const * >::value, "Should be true." ); + static_assert( std::is_same< ConstPointer< std::vector< double > >, double const* >::value, "Should be true." ); + static_assert( std::is_same< ConstPointer< std::string >, char const * >::value, "Should be true." ); + static_assert( std::is_same< ConstPointer< array3d< std::string > >, std::string const * >::value, "Should be true." ); + static_assert( std::is_same< ConstPointer< SortedArray< float > >, float const * >::value, "Should be true." ); } - -TEST(testGeosxTraits,test_is_string) +TEST( testGeosxTraits, has_alias_value_type ) { - static_assert(is_string, "Should be true"); + static_assert( has_alias_value_type< array1d< double > >, "Should be true." ); + static_assert( has_alias_value_type< array5d< array1d< R1Tensor > > >, "Should be true." ); + static_assert( has_alias_value_type< SortedArray< string > >, "Should be true." ); + static_assert( has_alias_value_type< std::vector< int > >, "Should be true." ); + static_assert( has_alias_value_type< std::map< string, string > >, "Should be true." ); + + static_assert( !has_alias_value_type< int >, "Should be false." ); + static_assert( !has_alias_value_type< double >, "Should be false." ); + static_assert( !has_alias_value_type< R2SymTensor >, "Should be false." ); +} - static_assert(!is_string, "Should be false"); - static_assert(!is_string, "Should be false"); - static_assert(!is_string, "Should be false"); +TEST( testGeosxTraits, has_data_method ) +{ + static_assert( has_data_method< array1d< double > >, "Should be true." ); + static_assert( has_data_method< array5d< array1d< R1Tensor > > >, "Should be true." ); + static_assert( has_data_method< std::vector< int > >, "Should be true." ); + + static_assert( !has_data_method< std::map< string, string > >, "Should be false." ); + static_assert( !has_data_method< SortedArray< string > >, "Should be false." ); + static_assert( !has_data_method< int >, "Should be false." ); + static_assert( !has_data_method< double >, "Should be false." ); + static_assert( !has_data_method< R2SymTensor >, "Should be false." ); } -TEST(testGeosxTraits,test_is_array) +TEST( testGeosxTraits, has_chai_move_method ) { - static_assert(is_array< LvArray::Array< int, 1, camp::make_idx_seq< 0 >::type, int > >, "Should be true"); + static_assert( has_chai_move_method< array1d< double > >, "Should be true." ); + static_assert( has_chai_move_method< array5d< array1d< R1Tensor > > >, "Should be true." ); + static_assert( has_chai_move_method< SortedArray< string > >, "Should be true." ); + static_assert( has_chai_move_method< ArrayOfArrays< int > >, "Should be true." ); - static_assert(!is_array, "Should be false"); - static_assert(!is_array, "Should be false"); - static_assert(!is_array, "Should be false"); + static_assert( !has_chai_move_method< std::vector< int > >, "Should be true." ); + static_assert( !has_chai_move_method< std::map< string, string > >, "Should be true." ); + static_assert( !has_chai_move_method< int >, "Should be false." ); + static_assert( !has_chai_move_method< double >, "Should be false." ); + static_assert( !has_chai_move_method< R2SymTensor >, "Should be false." ); } -TEST(testGeosxTraits,test_is_map) +TEST( testGeosxTraits, has_empty_method ) { - static_assert(is_map>, "Should be true"); - static_assert(is_map>, "Should be true"); + static_assert( has_empty_method< array1d< double > >, "Should be true." ); + static_assert( has_empty_method< array5d< array1d< R1Tensor > > >, "Should be true." ); + static_assert( has_empty_method< SortedArray< string > >, "Should be true." ); + static_assert( has_empty_method< std::vector< int > >, "Should be true." ); + static_assert( has_empty_method< std::map< string, string > >, "Should be true." ); + + static_assert( !has_empty_method< int >, "Should be false." ); + static_assert( !has_empty_method< double >, "Should be false." ); + static_assert( !has_empty_method< R2SymTensor >, "Should be false." ); +} - static_assert(!is_map, "Should be false"); - static_assert(!is_map, "Should be false"); - static_assert(!is_map, "Should be false"); - SUCCEED(); +TEST( testGeosxTraits, has_size_method ) +{ + static_assert( has_size_method< array1d< double > >, "Should be true." ); + static_assert( has_size_method< array5d< array1d< R1Tensor > > >, "Should be true." ); + static_assert( has_size_method< SortedArray< string > >, "Should be true." ); + static_assert( has_size_method< std::vector< int > >, "Should be true." ); + static_assert( has_size_method< std::map< string, string > >, "Should be true." ); + + static_assert( !has_size_method< int >, "Should be false." ); + static_assert( !has_size_method< double >, "Should be false." ); + static_assert( !has_size_method< R2SymTensor >, "Should be false." ); } -TEST(testGeosxTraits,test_is_set) +TEST( testGeosxTraits, has_dimension_size_method ) { - static_assert(is_set>, "Should be true"); + static_assert( has_dimension_size_method< array1d< double > >, "Should be true." ); + static_assert( has_dimension_size_method< array5d< array1d< R1Tensor > > >, "Should be true." ); + + static_assert( !has_dimension_size_method< SortedArray< string > >, "Should be false." ); + static_assert( !has_dimension_size_method< std::vector< int > >, "Should be false." ); + static_assert( !has_dimension_size_method< std::map< string, string > >, "Should be false." ); + static_assert( !has_dimension_size_method< int >, "Should be false." ); + static_assert( !has_dimension_size_method< double >, "Should be false." ); + static_assert( !has_dimension_size_method< R2SymTensor >, "Should be false." ); +} - static_assert(!is_set, "Should be false"); - static_assert(!is_set, "Should be false"); - static_assert(!is_set, "Should be false"); - SUCCEED(); +TEST( testGeosxTraits, has_resize_method ) +{ + static_assert( has_resize_method< array1d< double > >, "Should be true." ); + static_assert( has_resize_method< array5d< array1d< R1Tensor > > >, "Should be true." ); + static_assert( has_resize_method< std::vector< int > >, "Should be true." ); + + static_assert( !has_resize_method< SortedArray< string > >, "Should be false." ); + static_assert( !has_resize_method< std::map< string, string > >, "Should be false." ); + static_assert( !has_resize_method< int >, "Should be false." ); + static_assert( !has_resize_method< double >, "Should be false." ); + static_assert( !has_resize_method< R2SymTensor >, "Should be false." ); } -TEST(testGeosxTraits,test_is_pair) +TEST( testGeosxTraits, has_resize_default_method ) { - static_assert(is_pair>, "Should be true"); + static_assert( has_resize_default_method< array1d< double >, double >, "Should be true." ); + static_assert( has_resize_default_method< array5d< array1d< R1Tensor > >, array1d< R1Tensor > >, "Should be true." ); + static_assert( has_resize_default_method< array2d< std::string >, std::string >, "Should be true." ); + + static_assert( !has_resize_default_method< array1d< double >, int >, "Should be false." ); + static_assert( !has_resize_default_method< array5d< array1d< R1Tensor > >, array1d< float > >, "Should be false." ); + static_assert( !has_resize_default_method< array2d< std::string >, char >, "Should be false." ); + + static_assert( !has_resize_default_method< std::vector< int >, int >, "Should be false." ); + static_assert( !has_resize_default_method< SortedArray< std::string >, std::string >, "Should be false." ); + static_assert( !has_resize_default_method< std::map< string, string >, float >, "Should be false." ); + static_assert( !has_resize_default_method< int, int >, "Should be false." ); + static_assert( !has_resize_default_method< double, std::string >, "Should be false." ); + static_assert( !has_resize_default_method< R2SymTensor, char >, "Should be false." ); +} - static_assert(!is_pair, "Should be false"); - static_assert(!is_pair, "Should be false"); - static_assert(!is_pair, "Should be false"); - SUCCEED(); +TEST( testGeosxTraits, has_resize_dimensions_method ) +{ + static_assert( has_resize_dimensions_method< array1d< double > >, "Should be true." ); + static_assert( has_resize_dimensions_method< array5d< array1d< R1Tensor > > >, "Should be true." ); + + static_assert( !has_resize_dimensions_method< SortedArray< string > >, "Should be false." ); + static_assert( !has_resize_dimensions_method< std::vector< int > >, "Should be false." ); + static_assert( !has_resize_dimensions_method< std::map< string, string > >, "Should be false." ); + static_assert( !has_resize_dimensions_method< int >, "Should be false." ); + static_assert( !has_resize_dimensions_method< double >, "Should be false." ); + static_assert( !has_resize_dimensions_method< R2SymTensor >, "Should be false." ); } -TEST(testGeosxTraits,test_is_noncontainer_type_packable) +TEST( testGeosxTraits, is_tensorT ) { - EXPECT_TRUE( is_noncontainer_type_packable::value ); - EXPECT_TRUE( is_noncontainer_type_packable::value ); - EXPECT_FALSE( is_noncontainer_type_packable::value ); - EXPECT_TRUE( is_noncontainer_type_packable::value ); - EXPECT_FALSE( is_noncontainer_type_packable< array1d >::value ); - EXPECT_FALSE( is_noncontainer_type_packable< set >::value ); - using mapType = map; - EXPECT_FALSE( is_noncontainer_type_packable< mapType >::value ); - using pairType = std::pair; - EXPECT_FALSE( is_noncontainer_type_packable< pairType >::value ); + static_assert( is_tensorT< R1Tensor >, "Should be true." ); + static_assert( is_tensorT< R2Tensor >, "Should be true." ); + static_assert( is_tensorT< R2SymTensor >, "Should be true." ); + + static_assert( !is_tensorT< int >, "Should be false." ); + static_assert( !is_tensorT< double >, "Should be false." ); + static_assert( !is_tensorT< void >, "Should be false." ); } -TEST(testGeosxTraits,test_is_array_packable) +TEST( testGeosxTraits, is_string ) { - using arrayType = LvArray::Array::type,long int>; - EXPECT_TRUE( is_packable_array::value ); + static_assert( is_string< string >, "Should be true." ); - using arrayType0 = LvArray::Array::type,int>; - EXPECT_FALSE( is_packable_array::value ); + static_assert( !is_string< int >, "Should be false." ); + static_assert( !is_string< double >, "Should be false." ); + static_assert( !is_string< void >, "Should be false." ); +} - EXPECT_FALSE( is_packable_array::value ); - EXPECT_FALSE( is_packable_array::value ); - EXPECT_FALSE( is_packable_array::value ); +TEST( testGeosxTraits, is_array ) +{ + static_assert( is_array< LvArray::Array< int, 1, camp::make_idx_seq< 0 >::type, int > >, "Should be true." ); + + static_assert( !is_array< int >, "Should be false." ); + static_assert( !is_array< double >, "Should be false." ); + static_assert( !is_array< void >, "Should be false." ); } +TEST( testGeosxTraits, is_map ) +{ + static_assert( is_map< map< string, int > >, "Should be true." ); + static_assert( is_map< unordered_map< string, int > >, "Should be true." ); + + static_assert(!is_map< int >, "Should be false." ); + static_assert(!is_map< double >, "Should be false." ); + static_assert(!is_map< void >, "Should be false." ); + SUCCEED(); +} -TEST(testGeosxTraits,test_is_packable_map) +TEST( testGeosxTraits, is_set ) { - using mapType0 = map; - EXPECT_TRUE( is_packable_map< mapType0 >::value ); + static_assert( is_set< set< string > >, "Should be true." ); - using mapType1 = map >; - EXPECT_FALSE( is_packable_map< mapType1 >::value ); + static_assert( !is_set< int >, "Should be false." ); + static_assert( !is_set< double >, "Should be false." ); + static_assert( !is_set< void >, "Should be false." ); + SUCCEED(); +} - using arrayType = LvArray::Array::type,int>; - using mapType2 = map; - EXPECT_TRUE( is_packable_map< mapType2 >::value ); +TEST( testGeosxTraits, is_pair ) +{ + static_assert( is_pair< std::pair< string, int > >, "Should be true." ); + static_assert( !is_pair< int >, "Should be false" ); + static_assert( !is_pair< double >, "Should be false" ); + static_assert( !is_pair< void >, "Should be false" ); } + diff --git a/src/coreComponents/common/DataTypes.hpp b/src/coreComponents/common/DataTypes.hpp index d765e55d7ba..e190462d2da 100644 --- a/src/coreComponents/common/DataTypes.hpp +++ b/src/coreComponents/common/DataTypes.hpp @@ -35,9 +35,6 @@ // TPL includes #include -#ifdef GEOSX_USE_ATK - #include -#endif // System includes #ifdef GEOSX_USE_MPI @@ -55,6 +52,12 @@ #include #include #include +#include + +/// macro definition to specify whether or not to use dynamic_cast +#ifndef USE_DYNAMIC_CASTING + #define USE_DYNAMIC_CASTING 1 +#endif /** * top level geosx namespace contains all code that is specific to GEOSX @@ -62,6 +65,31 @@ namespace geosx { +template< typename NEW_TYPE, typename EXISTING_TYPE > +NEW_TYPE dynamicCast( EXISTING_TYPE * const val ) +{ + static_assert( std::is_pointer< NEW_TYPE >::value, "NEW_TYPE must be a pointer." ); + +#if USE_DYNAMIC_CASTING + NEW_TYPE const newVal = dynamic_cast< NEW_TYPE >( val ); +#else + NEW_TYPE const newVal = static_cast< NEW_TYPE >( val ); +#endif + + return newVal; +} + +template< typename NEW_TYPE, typename EXISTING_TYPE > +NEW_TYPE dynamicCast( EXISTING_TYPE & val ) +{ + static_assert( std::is_reference< NEW_TYPE >::value, "NEW_TYPE must be a reference." ); + + using POINTER_TO_NEW_TYPE = std::remove_reference_t< NEW_TYPE > *; + POINTER_TO_NEW_TYPE ptr = dynamicCast< POINTER_TO_NEW_TYPE >( &val ); + GEOS_ERROR_IF( ptr == nullptr, "Cast failed." ); + + return *ptr; +} #ifdef GEOSX_USE_MPI extern MPI_Comm MPI_COMM_GEOSX; @@ -99,82 +127,82 @@ using real64_ptr = ptr< real64 >; using real64_const_ptr = const_ptr< real64 >; -using buffer_unit_type = char; +using buffer_unit_type = signed char; using buffer_type = std::vector< buffer_unit_type >; //***** BEGIN ARRAY TYPEDEFS ***** template< typename T, int NDIM, typename PERMUTATION=camp::make_idx_seq_t< NDIM > > -using array_decl = LvArray::Array< T, NDIM, PERMUTATION, localIndex >; +using Array = LvArray::Array< T, NDIM, PERMUTATION, localIndex >; template< typename T, int NDIM, int UNIT_STRIDE_DIM = NDIM - 1 > -using array_view = LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, localIndex >; +using ArrayView = LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, localIndex >; template< typename T, int NDIM, int UNIT_STRIDE_DIM = NDIM - 1 > -using array_slice = LvArray::ArraySlice< T, NDIM, UNIT_STRIDE_DIM, localIndex >; +using ArraySlice = LvArray::ArraySlice< T, NDIM, UNIT_STRIDE_DIM, localIndex >; template< typename T, int NDIM, int MAXSIZE, typename PERMUTATION=camp::make_idx_seq_t< NDIM > > -using stack_array = LvArray::Array< T, NDIM, PERMUTATION, localIndex, LvArray::StackArrayWrapper< T, MAXSIZE > >; +using StackArray = LvArray::Array< T, NDIM, PERMUTATION, localIndex, LvArray::StackArrayWrapper< T, MAXSIZE > >; template< typename T > -using array1d = array_decl< T, 1 >; +using array1d = Array< T, 1 >; template< typename T > -using arrayView1d = array_view< T, 1 >; +using arrayView1d = ArrayView< T, 1 >; template< typename T, int UNIT_STRIDE_DIM = 0 > -using arraySlice1d = array_slice< T, 1, UNIT_STRIDE_DIM >; +using arraySlice1d = ArraySlice< T, 1, UNIT_STRIDE_DIM >; template< typename T, int MAXSIZE > -using stackArray1d = stack_array< T, 1, MAXSIZE >; +using stackArray1d = StackArray< T, 1, MAXSIZE >; template< typename T, typename PERMUTATION=camp::make_idx_seq_t< 2 > > -using array2d = array_decl< T, 2, PERMUTATION >; +using array2d = Array< T, 2, PERMUTATION >; template< typename T, int UNIT_STRIDE_DIM = 1 > -using arrayView2d = array_view< T, 2, UNIT_STRIDE_DIM >; +using arrayView2d = ArrayView< T, 2, UNIT_STRIDE_DIM >; template< typename T, int UNIT_STRIDE_DIM = 1 > -using arraySlice2d = array_slice< T, 2, UNIT_STRIDE_DIM >; +using arraySlice2d = ArraySlice< T, 2, UNIT_STRIDE_DIM >; template< typename T, int MAXSIZE > -using stackArray2d = stack_array< T, 2, MAXSIZE >; +using stackArray2d = StackArray< T, 2, MAXSIZE >; -template< typename T > -using array3d = array_decl< T, 3 >; +template< typename T, typename PERMUTATION=camp::make_idx_seq_t< 3 > > +using array3d = Array< T, 3, PERMUTATION >; -template< typename T > -using arrayView3d = array_view< T, 3 >; +template< typename T, int UNIT_STRIDE_DIM=2 > +using arrayView3d = ArrayView< T, 3, UNIT_STRIDE_DIM >; -template< typename T > -using arraySlice3d = array_slice< T, 3 >; +template< typename T, int UNIT_STRIDE_DIM=2 > +using arraySlice3d = ArraySlice< T, 3, UNIT_STRIDE_DIM >; template< typename T, int MAXSIZE > -using stackArray3d = stack_array< T, 3, MAXSIZE >; +using stackArray3d = StackArray< T, 3, MAXSIZE >; template< typename T > -using array4d = array_decl< T, 4 >; +using array4d = Array< T, 4 >; template< typename T > -using arrayView4d = array_view< T, 4 >; +using arrayView4d = ArrayView< T, 4 >; template< typename T > -using arraySlice4d = array_slice< T, 4 >; +using arraySlice4d = ArraySlice< T, 4 >; template< typename T, int MAXSIZE > -using stackArray4d = stack_array< T, 4, MAXSIZE >; +using stackArray4d = StackArray< T, 4, MAXSIZE >; template< typename T > -using array5d = array_decl< T, 5 >; +using array5d = Array< T, 5 >; template< typename T > -using arrayView5d = array_view< T, 5 >; +using arrayView5d = ArrayView< T, 5 >; template< typename T > -using arraySlice5d = array_slice< T, 5 >; +using arraySlice5d = ArraySlice< T, 5 >; template< typename T, int MAXSIZE > -using stackArray5d = stack_array< T, 5, MAXSIZE >; +using stackArray5d = StackArray< T, 5, MAXSIZE >; template< typename T > using set = LvArray::SortedArray< T, localIndex >; @@ -543,68 +571,6 @@ class rtTypes } } -#ifdef GEOSX_USE_ATK - - static axom::sidre::TypeID toSidreType( std::type_index typeIndex ) - { - const axom::sidre::TypeID integer_id = axom::sidre::detail::SidreTT< integer >::id; - const axom::sidre::TypeID localIndex_id = axom::sidre::detail::SidreTT< localIndex >::id; - - /* We can't use SidreTT::id here because that returns NO_TYPE_ID. - * This is due to a mismatch between globalIndex (long long int) and std::int64_t */ - const axom::sidre::TypeID globalIndex_id = axom::sidre::detail::SidreTT< axom::int64 >::id; - - const axom::sidre::TypeID real32_id = axom::sidre::detail::SidreTT< real32 >::id; - const axom::sidre::TypeID real64_id = axom::sidre::detail::SidreTT< real64 >::id; - const axom::sidre::TypeID char_id = axom::sidre::TypeID::UINT8_ID; - - const std::unordered_map< std::type_index, axom::sidre::TypeID > sidre_types = - { - { std::type_index( typeid(integer)), integer_id }, - { std::type_index( typeid(localIndex)), localIndex_id }, - { std::type_index( typeid(globalIndex)), globalIndex_id }, - { std::type_index( typeid(real32)), real32_id }, - { std::type_index( typeid(real64)), real64_id }, - { std::type_index( typeid(R1Tensor)), real64_id }, - { std::type_index( typeid(R2Tensor)), real64_id }, - { std::type_index( typeid(R2SymTensor)), real64_id }, - { std::type_index( typeid(char)), char_id } - }; - - auto it = sidre_types.find( typeIndex ); - if( it == sidre_types.end()) - { - return axom::sidre::TypeID::NO_TYPE_ID; - } - return it->second; - } - - static localIndex getSidreSize( std::type_index typeIndex ) - { - const std::unordered_map< std::type_index, localIndex > sidre_sizes = - { - { std::type_index( typeid(integer)), sizeof(integer) }, - { std::type_index( typeid(localIndex)), sizeof(localIndex) }, - { std::type_index( typeid(globalIndex)), sizeof(globalIndex) }, - { std::type_index( typeid(real32)), sizeof(real32) }, - { std::type_index( typeid(real64)), sizeof(real64) }, - { std::type_index( typeid(R1Tensor)), sizeof(real64) }, - { std::type_index( typeid(R2Tensor)), sizeof(real64) }, - { std::type_index( typeid(R2SymTensor)), sizeof(real64) }, - { std::type_index( typeid(char)), sizeof(char) } - }; - - auto it = sidre_sizes.find( typeIndex ); - if( it == sidre_sizes.end()) - { - GEOS_ERROR( "Unsupported type of with type index name: " << typeIndex.name()); - } - return it->second; - } - -#endif /* GEOSX_USE_ATK */ - - // Matching regex for data types in xml class typeRegex { diff --git a/src/coreComponents/constitutive/Fluid/MultiFluidBase.hpp b/src/coreComponents/constitutive/Fluid/MultiFluidBase.hpp index 12d02825fc8..5d9dfc10fd6 100644 --- a/src/coreComponents/constitutive/Fluid/MultiFluidBase.hpp +++ b/src/coreComponents/constitutive/Fluid/MultiFluidBase.hpp @@ -32,21 +32,21 @@ namespace detail { template -struct array_slice_helper +struct ArraySlice_helper { - using type = array_slice; + using type = ArraySlice; }; // an array slice of DIM=0 decays to a reference to scalar template -struct array_slice_helper +struct ArraySlice_helper { using type = T &; }; // an array1 slice of DIM=1 uses specialization (possibly a raw pointer) template -struct array_slice_helper +struct ArraySlice_helper { using type = arraySlice1d; }; @@ -54,19 +54,19 @@ struct array_slice_helper } template -using real_array_slice = typename detail::array_slice_helper::type; +using real_ArraySlice = typename detail::ArraySlice_helper::type; template -using real_array_const_slice = typename detail::array_slice_helper::type; +using real_array_const_slice = typename detail::ArraySlice_helper::type; // helper struct to represent a var and its derivatives template struct CompositionalVarContainer { - real_array_slice value; // variable value - real_array_slice dPres; // derivative w.r.t. pressure - real_array_slice dTemp; // derivative w.r.t. temperature - real_array_slice dComp; // derivative w.r.t. composition + real_ArraySlice value; // variable value + real_ArraySlice dPres; // derivative w.r.t. pressure + real_ArraySlice dTemp; // derivative w.r.t. temperature + real_ArraySlice dComp; // derivative w.r.t. composition }; template diff --git a/src/coreComponents/constitutive/unitTests/testMultiFluid.cpp b/src/coreComponents/constitutive/unitTests/testMultiFluid.cpp index 00c765b0f5c..b1c632657ae 100644 --- a/src/coreComponents/constitutive/unitTests/testMultiFluid.cpp +++ b/src/coreComponents/constitutive/unitTests/testMultiFluid.cpp @@ -133,7 +133,7 @@ void testNumericalDerivatives( MultiFluidBase * fluid, // extract data views from both fluids #define GET_FLUID_DATA( FLUID, DIM, KEY ) \ - FLUID->getReference>( MultiFluidBase::viewKeyStruct::KEY )[0][0] + FLUID->getReference>( MultiFluidBase::viewKeyStruct::KEY )[0][0] CompositionalVarContainer<1> phaseFrac { GET_FLUID_DATA( fluid, 3, phaseFractionString ), diff --git a/src/coreComponents/cxx-utilities b/src/coreComponents/cxx-utilities index f2e649e8bd1..e749a8604d1 160000 --- a/src/coreComponents/cxx-utilities +++ b/src/coreComponents/cxx-utilities @@ -1 +1 @@ -Subproject commit f2e649e8bd142eb62cc6d6ff944a513dcaec294c +Subproject commit e749a8604d160ec16401752c8a86835c71bac5cb diff --git a/src/coreComponents/dataRepository/BufferOps.hpp b/src/coreComponents/dataRepository/BufferOps.hpp index 74f5a2f695d..a9e7657e807 100644 --- a/src/coreComponents/dataRepository/BufferOps.hpp +++ b/src/coreComponents/dataRepository/BufferOps.hpp @@ -35,74 +35,146 @@ class InterObjectRelation; namespace bufferOps { +/* Forward declaration of is_packable */ +template< typename T > +struct is_packable_helper; + + +template< typename T > +constexpr bool is_noncontainer_type_packable = std::is_trivial< T >::value || + std::is_arithmetic< T >::value || + traits::is_tensorT< T > || + traits::is_string< T >; + + +template< typename > +constexpr bool is_packable_array = false; + +template< typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE > +constexpr bool is_packable_array< LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > > = is_packable_helper< T >::value; + +template< typename T, int NDIM, int UNIT_STRIDE_DIM, typename INDEX_TYPE > +constexpr bool is_packable_array< LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > > = is_packable_helper< T >::value; + +template< typename T, int NDIM, int UNIT_STRIDE_DIM, typename INDEX_TYPE > +constexpr bool is_packable_array< LvArray::ArraySlice< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > > = is_packable_helper< T >::value; + +template< typename T, typename INDEX_TYPE > +constexpr bool is_packable_array< LvArray::ArrayOfArrays< T, INDEX_TYPE > > = is_packable_helper< T >::value; + + +template< typename > +constexpr bool is_packable_set = false; + +template< typename T > +constexpr bool is_packable_set< set< T > > = is_packable_helper< T >::value; + + +template< typename > +constexpr bool is_packable_map = false; + +template< typename T_KEY, typename T_VAL, typename SORTED > +constexpr bool is_packable_map< mapBase< T_KEY, T_VAL, SORTED > > = is_packable_helper< T_KEY >::value && + is_packable_helper< T_VAL >::value; + + +template< typename T > +struct is_packable_helper +{ + static constexpr bool value = is_noncontainer_type_packable< T > || + is_packable_array< T > || + is_packable_map< T > || + is_packable_set< T >; +}; + +template< typename T > +constexpr bool is_packable = is_packable_helper< T >::value; + +template< typename T > +constexpr bool is_packable_by_index = is_packable_array< T >; + +template< typename > +constexpr bool is_map_packable_by_index = false; + +template< typename T_KEY, typename T_VAL, typename SORTED > +constexpr bool is_map_packable_by_index< mapBase< T_KEY, T_VAL, SORTED > > = is_packable< T_KEY > && + is_packable_by_index< T_VAL >; + +template< typename T > +constexpr bool can_memcpy_helper = std::is_arithmetic< T >::value || + traits::is_tensorT< T >; + +template< typename T > +constexpr bool can_memcpy = can_memcpy_helper< std::remove_const_t< std::remove_pointer_t< T > > >; + //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, T const & var ); //------------------------------------------------------------------------------ template< typename T > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, T & var ); //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T, typename INDEX_TYPE > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, T const * const restrict var, INDEX_TYPE const length ); //------------------------------------------------------------------------------ template< typename T, typename INDEX_TYPE > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, T * const restrict var, INDEX_TYPE const expectedLength ); //------------------------------------------------------------------------------ template< bool DO_PACKING > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, const std::string & var ); //------------------------------------------------------------------------------ inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, string & var ); //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T > typename std::enable_if< traits::is_tensorT< T >, localIndex >::type -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, T const & var ); //------------------------------------------------------------------------------ template< typename T > typename std::enable_if< traits::is_tensorT< T >, localIndex >::type -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, T & var ); //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T, typename INDEX_TYPE > typename std::enable_if< !std::is_trivial< T >::value, localIndex >::type -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, T const * const restrict var, INDEX_TYPE const length ); //------------------------------------------------------------------------------ template< typename T, typename INDEX_TYPE > typename std::enable_if< !std::is_trivial< T >::value, localIndex >::type -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, T * const restrict var, INDEX_TYPE const expectedLength ); //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, T const * const restrict var, arraySlice1d< INDEX_TYPE const, UNIT_STRIDE_DIM > const & indices, INDEX_TYPE const length ); @@ -110,7 +182,7 @@ Pack( char * & buffer, //------------------------------------------------------------------------------ template< typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, T * const restrict var, arraySlice1d< INDEX_TYPE const, UNIT_STRIDE_DIM > const & indices, INDEX_TYPE & length ); @@ -118,35 +190,35 @@ Unpack( char const * & buffer, //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arraySlice1d< T const, UNIT_STRIDE_DIM > const & var, INDEX_TYPE const length ); //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > typename std::enable_if< !std::is_trivial< T >::value, localIndex >::type -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arraySlice1d< T const, UNIT_STRIDE_DIM > const & var, INDEX_TYPE const length ); //------------------------------------------------------------------------------ template< typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arraySlice1d< T, UNIT_STRIDE_DIM > const & var, INDEX_TYPE const expectedLength ); //------------------------------------------------------------------------------ template< typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > typename std::enable_if< !std::is_trivial< T >::value, localIndex >::type -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arraySlice1d< T, UNIT_STRIDE_DIM > const & var, INDEX_TYPE const expectedLength ); //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM0, int UNIT_STRIDE_DIM1 > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arraySlice1d< T const, UNIT_STRIDE_DIM0 > const & var, arraySlice1d< INDEX_TYPE const, UNIT_STRIDE_DIM1 > const & indices, INDEX_TYPE const length ); @@ -154,7 +226,7 @@ Pack( char * & buffer, //------------------------------------------------------------------------------ template< typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM0, int UNIT_STRIDE_DIM1 > localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arraySlice1d< T, UNIT_STRIDE_DIM0 > const & var, arraySlice1d< INDEX_TYPE const, UNIT_STRIDE_DIM1 > const & indices, INDEX_TYPE & length ); @@ -163,17 +235,17 @@ Unpack( char const * & buffer, //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T > localIndex -Pack( char * & buffer, set< T > const & var ); +Pack( buffer_unit_type * & buffer, set< T > const & var ); //------------------------------------------------------------------------------ template< typename T > localIndex -Unpack( char const * & buffer, set< T > & var ); +Unpack( buffer_unit_type const * & buffer, set< T > & var ); //------------------------------------------------------------------------------ template< bool DO_PACKING, int UNIT_STRIDE_DIM > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, set< localIndex > const & var, set< globalIndex > const & unmappedGlobalIndices, arraySlice1d< globalIndex const, UNIT_STRIDE_DIM > const & localToGlobal ); @@ -182,7 +254,7 @@ Pack( char * & buffer, template< typename SORTED > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, set< localIndex > & var, set< globalIndex > & unmappedGlobalIndices, mapBase< globalIndex, localIndex, SORTED > const & globalToLocalMap, @@ -190,26 +262,26 @@ Unpack( char const * & buffer, //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T, int NDIM, int UNIT_STRIDE_DIM, typename INDEX_TYPE > -typename std::enable_if< bufferOps::is_packable_array< LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > >::value, localIndex >::type -Pack( char * & buffer, +typename std::enable_if< is_packable< T >, localIndex >::type +Pack( buffer_unit_type * & buffer, LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > const & var ); //------------------------------------------------------------------------------ template< typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE > -typename std::enable_if< bufferOps::is_packable_array< LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > >::value, localIndex >::type -Unpack( char const * & buffer, LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > & var ); +typename std::enable_if< is_packable< T >, localIndex >::type +Unpack( buffer_unit_type const * & buffer, LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > & var ); //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T, int NDIM, int UNIT_STRIDE_DIM, typename T_indices, typename INDEX_TYPE > -typename std::enable_if< bufferOps::is_packable_array< LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > >::value, localIndex >::type -Pack( char * & buffer, +typename std::enable_if< is_packable< T >, localIndex >::type +Pack( buffer_unit_type * & buffer, LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > const & var, const T_indices & indices ); //------------------------------------------------------------------------------ template< typename T, int NDIM, int UNIT_STRIDE_DIM, typename T_indices, typename INDEX_TYPE > localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > & var, const T_indices & indices ); @@ -217,41 +289,41 @@ Unpack( char const * & buffer, //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T, typename INDEX_TYPE > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, LvArray::ArrayOfArrays< T, INDEX_TYPE > const & var ); template< typename T, typename INDEX_TYPE > localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, LvArray::ArrayOfArrays< T, INDEX_TYPE > & var ); template< bool DO_PACKING, typename T, typename INDEX_TYPE > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, LvArray::ArrayOfSets< T, INDEX_TYPE > const & var ); template< typename T, typename INDEX_TYPE > localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, LvArray::ArrayOfSets< T, INDEX_TYPE > & var ); template< bool DO_PACKING, typename T, typename INDEX_TYPE, typename T_indices > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, LvArray::ArrayOfArrays< T, INDEX_TYPE > const & var, T_indices const & indices ); template< typename T, typename INDEX_TYPE, typename T_indices > localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, LvArray::ArrayOfArrays< T, INDEX_TYPE > & var, T_indices const & indices ); //------------------------------------------------------------------------------ template< bool DO_PACKING, int UNIT_STRIDE_DIM > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arraySlice1d< localIndex const, UNIT_STRIDE_DIM > const & var, globalIndex const * const unmappedGlobalIndices, localIndex const length, @@ -261,7 +333,7 @@ Pack( char * & buffer, template< typename SORTED > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, localIndex_array & var, array1d< globalIndex > & unmappedGlobalIndices, mapBase< globalIndex, localIndex, SORTED > const & globalToLocalMap ); @@ -270,7 +342,7 @@ Unpack( char const * & buffer, template< typename SORTED, int UNIT_STRIDE_DIM > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arraySlice1d< localIndex, UNIT_STRIDE_DIM > const & var, array1d< globalIndex > & unmappedGlobalIndices, localIndex const expectedLength, @@ -279,7 +351,7 @@ Unpack( char const * & buffer, //------------------------------------------------------------------------------ template< bool DO_PACKING > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arrayView1d< localIndex const > const & var, arrayView1d< localIndex const > const & indices, arrayView1d< globalIndex const > const & localToGlobalMap, @@ -289,7 +361,7 @@ Pack( char * & buffer, template< typename SORTED0, typename SORTED1 > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arrayView1d< localIndex > & var, array1d< localIndex > const & indices, mapBase< globalIndex, localIndex, SORTED0 > const & globalToLocalMap, @@ -299,7 +371,7 @@ Unpack( char const * & buffer, //------------------------------------------------------------------------------ template< bool DO_PACKING, typename SORTED > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arrayView1d< localIndex_array const > const & var, mapBase< localIndex, array1d< globalIndex >, SORTED > const & unmappedGlobalIndices, arrayView1d< localIndex const > const & indices, @@ -310,7 +382,7 @@ Pack( char * & buffer, template< typename SORTED0, typename SORTED1, typename SORTED2 > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arrayView1d< localIndex_array > & var, array1d< localIndex > & indices, mapBase< localIndex, array1d< globalIndex >, SORTED0 > & unmappedGlobalIndices, @@ -320,7 +392,7 @@ Unpack( char const * & buffer, //------------------------------------------------------------------------------ template< bool DO_PACKING, typename SORTED > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arrayView1d< set< localIndex > const > const & var, mapBase< localIndex, set< globalIndex >, SORTED > const & unmappedGlobalIndices, arrayView1d< localIndex const > const & indices, @@ -331,7 +403,7 @@ Pack( char * & buffer, template< typename SORTED0, typename SORTED1, typename SORTED2 > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arrayView1d< set< localIndex > > & var, localIndex_array & indices, mapBase< localIndex, set< globalIndex >, SORTED0 > & unmappedGlobalIndices, @@ -342,7 +414,7 @@ Unpack( char const * & buffer, //------------------------------------------------------------------------------ template< bool DO_PACKING, int UNIT_STRIDE_DIM0, int UNIT_STRIDE_DIM1 > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arrayView2d< localIndex const, UNIT_STRIDE_DIM0 > const & var, arrayView1d< localIndex > const & indices, arraySlice1d< globalIndex const, UNIT_STRIDE_DIM1 > const & localToGlobalMap ); @@ -351,7 +423,7 @@ Pack( char * & buffer, template< typename SORTED, int UNIT_STRIDE_DIM > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arrayView2d< localIndex, UNIT_STRIDE_DIM > const & var, array1d< localIndex > & indices, mapBase< globalIndex, localIndex, SORTED > const & globalToLocalMap ); @@ -359,7 +431,7 @@ Unpack( char const * & buffer, //------------------------------------------------------------------------------ template< bool DO_PACKING, typename SORTED, int UNIT_STRIDE_DIM0 > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arrayView2d< localIndex const, UNIT_STRIDE_DIM0 > const & var, mapBase< localIndex, array1d< globalIndex >, SORTED > const & unmappedGlobalIndices, arrayView1d< localIndex const > const & indices, @@ -370,7 +442,7 @@ Pack( char * & buffer, template< typename SORTED0, typename SORTED1, typename SORTED2, int UNIT_STRIDE_DIM > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arrayView2d< localIndex, UNIT_STRIDE_DIM > const & var, localIndex_array & indices, mapBase< localIndex, array1d< globalIndex >, SORTED0 > & unmappedGlobalIndices, @@ -378,42 +450,40 @@ Unpack( char const * & buffer, mapBase< globalIndex, localIndex, SORTED2 > const & relatedObjectGlobalToLocalMap ); //------------------------------------------------------------------------------ -template< bool DO_PACKING, typename T_KEY, typename T_VAL, typename SORTED > -typename std::enable_if< bufferOps::is_packable_map< mapBase< T_KEY, T_VAL, SORTED > >::value, localIndex >::type -Pack( char * & buffer, mapBase< T_KEY, T_VAL, SORTED > const & var ); +template< bool DO_PACKING, typename MAP_TYPE > +typename std::enable_if< is_packable_map< MAP_TYPE >, localIndex >::type +Pack( buffer_unit_type * & buffer, MAP_TYPE const & var ); //------------------------------------------------------------------------------ -template< typename T_KEY, typename T_VAL, typename SORTED > -typename std::enable_if< bufferOps::is_packable_map< mapBase< T_KEY, T_VAL, SORTED > >::value, localIndex >::type -Unpack( char const * & buffer, mapBase< T_KEY, T_VAL, - SORTED > & map ); +template< typename MAP_TYPE > +typename std::enable_if< is_packable_map< MAP_TYPE >, localIndex >::type +Unpack( buffer_unit_type const * & buffer, MAP_TYPE & map ); //------------------------------------------------------------------------------ -template< bool DO_PACKING, typename T_KEY, typename T_VAL, typename SORTED, typename T_INDICES > -typename std::enable_if< bufferOps::is_packable_map< mapBase< T_KEY, T_VAL, SORTED > >::value && bufferOps::is_packable_by_index< T_VAL >::value, localIndex >::type -Pack( char * & buffer, mapBase< T_KEY, T_VAL, SORTED > const & var, - T_INDICES const & packIndices ); +template< bool DO_PACKING, typename MAP_TYPE, typename T_INDICES > +typename std::enable_if< is_map_packable_by_index< MAP_TYPE >, localIndex >::type +Pack( buffer_unit_type * & buffer, MAP_TYPE const & var, T_INDICES const & packIndices ); //------------------------------------------------------------------------------ -template< typename T_KEY, typename T_VAL, typename SORTED, typename T_INDICES > -typename std::enable_if< bufferOps::is_packable_map< mapBase< T_KEY, T_VAL, SORTED > >::value && bufferOps::is_packable_by_index< T_VAL >::value, localIndex >::type -Unpack( char const * & buffer, mapBase< T_KEY, T_VAL, SORTED > & map, T_INDICES const & unpackIndices ); +template< typename MAP_TYPE, typename T_INDICES > +typename std::enable_if< is_map_packable_by_index< MAP_TYPE >, localIndex >::type +Unpack( buffer_unit_type const * & buffer, MAP_TYPE & map, T_INDICES const & unpackIndices ); //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T_FIRST, typename T_SECOND > localIndex -Pack( char * & buffer, std::pair< T_FIRST, T_SECOND > const & var ); +Pack( buffer_unit_type * & buffer, std::pair< T_FIRST, T_SECOND > const & var ); //------------------------------------------------------------------------------ template< typename T_FIRST, typename T_SECOND > localIndex -Unpack( char const * & buffer, std::pair< T_FIRST, T_SECOND > & var ); +Unpack( buffer_unit_type const * & buffer, std::pair< T_FIRST, T_SECOND > & var ); //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T > localIndex -Pack( char * & buffer, InterObjectRelation< T > const & var ) +Pack( buffer_unit_type * & buffer, InterObjectRelation< T > const & var ) { return Pack< DO_PACKING >( buffer, static_cast< T const & >(var)); } @@ -421,15 +491,15 @@ Pack( char * & buffer, InterObjectRelation< T > const & var ) //------------------------------------------------------------------------------ template< typename T > localIndex -Unpack( char const * & buffer, InterObjectRelation< T > & var ) +Unpack( buffer_unit_type const * & buffer, InterObjectRelation< T > & var ) { return Unpack( buffer, static_cast< T & >(var)); } //------------------------------------------------------------------------------ template< bool DO_PACKING, typename T > -typename std::enable_if< !bufferOps::is_packable< T >::value, localIndex >::type -Pack( char * & GEOSX_UNUSED_ARG( buffer ), T const & GEOSX_UNUSED_ARG( var ) ) +typename std::enable_if< !is_packable< T >, localIndex >::type +Pack( buffer_unit_type * & GEOSX_UNUSED_ARG( buffer ), T const & GEOSX_UNUSED_ARG( var ) ) { GEOS_ERROR( "Trying to pack data type ("< -typename std::enable_if< !bufferOps::is_packable< T >::value, localIndex >::type -Unpack( char const * & GEOSX_UNUSED_ARG( buffer ), T & GEOSX_UNUSED_ARG( var ) ) +typename std::enable_if< !is_packable< T >, localIndex >::type +Unpack( buffer_unit_type const * & GEOSX_UNUSED_ARG( buffer ), T & GEOSX_UNUSED_ARG( var ) ) { GEOS_ERROR( "Trying to unpack data type ("< -typename std::enable_if< !bufferOps::is_packable_by_index< T >::value, localIndex >::type -Pack( char * & GEOSX_UNUSED_ARG( buffer ), T const & GEOSX_UNUSED_ARG( var ), T_INDICES const & GEOSX_UNUSED_ARG( indices ) ) +typename std::enable_if< !is_packable_by_index< T > && + !is_map_packable_by_index< T >, localIndex >::type +Pack( buffer_unit_type * & GEOSX_UNUSED_ARG( buffer ), T const & GEOSX_UNUSED_ARG( var ), T_INDICES const & GEOSX_UNUSED_ARG( indices ) ) { GEOS_ERROR( "Trying to pack data type ("< -typename std::enable_if< !bufferOps::is_packable_by_index< T >::value, localIndex >::type -Unpack( char const * & GEOSX_UNUSED_ARG( buffer ), T & GEOSX_UNUSED_ARG( var ), T_INDICES const & GEOSX_UNUSED_ARG( indices ) ) +typename std::enable_if< !is_packable_by_index< T > && + !is_map_packable_by_index< T >, localIndex >::type +Unpack( buffer_unit_type const * & GEOSX_UNUSED_ARG( buffer ), T & GEOSX_UNUSED_ARG( var ), T_INDICES const & GEOSX_UNUSED_ARG( indices ) ) { GEOS_ERROR( "Trying to unpack data type ("< localIndex PackSize( VARPACK const && ... pack ) { - char * junk = nullptr; + buffer_unit_type * junk = nullptr; return Pack< false >( junk, pack ... ); } @@ -476,7 +548,7 @@ template< typename ... VARPACK > localIndex PackSize( VARPACK && ... pack ) { - char * junk = nullptr; + buffer_unit_type * junk = nullptr; return Pack< false >( junk, pack ... ); } diff --git a/src/coreComponents/dataRepository/BufferOps_inline.hpp b/src/coreComponents/dataRepository/BufferOps_inline.hpp index cbc9ce785f3..deec17f801d 100644 --- a/src/coreComponents/dataRepository/BufferOps_inline.hpp +++ b/src/coreComponents/dataRepository/BufferOps_inline.hpp @@ -35,7 +35,7 @@ namespace bufferOps */ template< bool DO_PACKING, typename T > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type -Pack( char * & buffer, T const & var ) +Pack( buffer_unit_type * & buffer, T const & var ) { localIndex const sizeOfPackedChars = sizeof(T); static_if( DO_PACKING ) @@ -54,7 +54,7 @@ Pack( char * & buffer, T const & var ) */ template< typename T > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type -Unpack( char const * & buffer, T & var ) +Unpack( buffer_unit_type const * & buffer, T & var ) { localIndex const sizeOfUnpackedChars = sizeof(T); memcpy( &var, buffer, sizeOfUnpackedChars ); @@ -65,7 +65,7 @@ Unpack( char const * & buffer, T & var ) template< bool DO_PACKING, typename T, typename INDEX_TYPE > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type -Pack( char * & buffer, T const * const restrict var, INDEX_TYPE const length ) +Pack( buffer_unit_type * & buffer, T const * const restrict var, INDEX_TYPE const length ) { localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, length ); @@ -83,7 +83,7 @@ Pack( char * & buffer, T const * const restrict var, INDEX_TYPE const length ) template< typename T, typename INDEX_TYPE > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type -Unpack( char const * & buffer, T * const restrict var, INDEX_TYPE const expectedLength ) +Unpack( buffer_unit_type const * & buffer, T * const restrict var, INDEX_TYPE const expectedLength ) { INDEX_TYPE length; localIndex sizeOfUnpackedChars = Unpack( buffer, length ); @@ -101,7 +101,7 @@ Unpack( char const * & buffer, T * const restrict var, INDEX_TYPE const expected template< bool DO_PACKING > -localIndex Pack( char * & buffer, const std::string & var ) +localIndex Pack( buffer_unit_type * & buffer, const std::string & var ) { const string::size_type varSize = var.size(); localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, varSize ); @@ -118,13 +118,13 @@ localIndex Pack( char * & buffer, const std::string & var ) } -inline localIndex Unpack( char const * & buffer, string & var ) +inline localIndex Unpack( buffer_unit_type const * & buffer, string & var ) { string::size_type stringsize = 0; localIndex sizeOfUnpackedChars = Unpack( buffer, stringsize ); var.resize( stringsize ); - var.assign( buffer, stringsize ); + var.assign( reinterpret_cast< char const * >( buffer ), stringsize ); buffer += stringsize; sizeOfUnpackedChars += stringsize; @@ -134,7 +134,7 @@ inline localIndex Unpack( char const * & buffer, string & var ) template< bool DO_PACKING, typename T > typename std::enable_if< traits::is_tensorT< T >, localIndex >::type -Pack( char * & buffer, T const & var ) +Pack( buffer_unit_type * & buffer, T const & var ) { localIndex sizeOfPackedChars = 0; sizeOfPackedChars += Pack< DO_PACKING >( buffer, var.Data(), var.Length()); @@ -144,7 +144,7 @@ Pack( char * & buffer, T const & var ) template< typename T > typename std::enable_if< traits::is_tensorT< T >, localIndex >::type -Unpack( char const * & buffer, T & var ) +Unpack( buffer_unit_type const * & buffer, T & var ) { localIndex sizeOfUnpackedChars = 0; real64 * const pVar = var.Data(); @@ -156,7 +156,7 @@ Unpack( char const * & buffer, T & var ) template< bool DO_PACKING, typename T, typename INDEX_TYPE > typename std::enable_if< !std::is_trivial< T >::value, localIndex >::type -Pack( char * & buffer, T const * const restrict var, INDEX_TYPE const length ) +Pack( buffer_unit_type * & buffer, T const * const restrict var, INDEX_TYPE const length ) { localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, length ); @@ -171,7 +171,7 @@ Pack( char * & buffer, T const * const restrict var, INDEX_TYPE const length ) template< typename T, typename INDEX_TYPE > typename std::enable_if< !std::is_trivial< T >::value, localIndex >::type -Unpack( char const * & buffer, T * const restrict var, INDEX_TYPE const expectedLength ) +Unpack( buffer_unit_type const * & buffer, T * const restrict var, INDEX_TYPE const expectedLength ) { INDEX_TYPE length; localIndex sizeOfUnpackedChars = Unpack( buffer, length ); @@ -191,7 +191,7 @@ Unpack( char const * & buffer, T * const restrict var, INDEX_TYPE const expected template< bool DO_PACKING, typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, T const * const restrict var, arraySlice1d< INDEX_TYPE const, UNIT_STRIDE_DIM > const & indices, INDEX_TYPE const length ) @@ -209,7 +209,7 @@ Pack( char * & buffer, template< typename T, typename INDEX_TYPE > localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, T * const restrict var, arraySlice1d< INDEX_TYPE const > const & indices, INDEX_TYPE & length ) @@ -227,7 +227,7 @@ Unpack( char const * & buffer, template< bool DO_PACKING, typename T, typename INDEX_TYPE > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arraySlice1d< T const > const & var, INDEX_TYPE const length ) { @@ -252,7 +252,7 @@ Pack( char * & buffer, template< bool DO_PACKING, typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > typename std::enable_if< !std::is_trivial< T >::value, localIndex >::type -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arraySlice1d< T const, UNIT_STRIDE_DIM > const & var, INDEX_TYPE const length ) { @@ -269,7 +269,7 @@ Pack( char * & buffer, template< typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > typename std::enable_if< std::is_trivial< T >::value, localIndex >::type -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arraySlice1d< T, UNIT_STRIDE_DIM > const & var, INDEX_TYPE const expectedLength ) { @@ -295,7 +295,7 @@ Unpack( char const * & buffer, template< typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM > typename std::enable_if< !std::is_trivial< T >::value, localIndex >::type -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arraySlice1d< T, UNIT_STRIDE_DIM > const & var, INDEX_TYPE const expectedLength ) { @@ -317,7 +317,7 @@ Unpack( char const * & buffer, template< bool DO_PACKING, typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM0, int UNIT_STRIDE_DIM1 > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arraySlice1d< T const, UNIT_STRIDE_DIM0 > const & var, arraySlice1d< INDEX_TYPE const, UNIT_STRIDE_DIM1 > const & indices, INDEX_TYPE const length ) @@ -335,7 +335,7 @@ Pack( char * & buffer, template< typename T, typename INDEX_TYPE, int UNIT_STRIDE_DIM0, int UNIT_STRIDE_DIM1 > localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arraySlice1d< T, UNIT_STRIDE_DIM0 > const & var, arraySlice1d< INDEX_TYPE const, UNIT_STRIDE_DIM1 > const & indices, INDEX_TYPE & length ) @@ -354,7 +354,7 @@ Unpack( char const * & buffer, template< bool DO_PACKING, typename T > -localIndex Pack( char * & buffer, set< T > const & var ) +localIndex Pack( buffer_unit_type * & buffer, set< T > const & var ) { const localIndex length = integer_conversion< localIndex >( var.size()); localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, length ); @@ -369,7 +369,7 @@ localIndex Pack( char * & buffer, set< T > const & var ) template< typename T > -localIndex Unpack( char const * & buffer, set< T > & var ) +localIndex Unpack( buffer_unit_type const * & buffer, set< T > & var ) { var.clear(); @@ -387,7 +387,7 @@ localIndex Unpack( char const * & buffer, set< T > & var ) } template< bool DO_PACKING, int UNIT_STRIDE_DIM > -localIndex Pack( char * & buffer, +localIndex Pack( buffer_unit_type * & buffer, set< localIndex > const & var, set< globalIndex > const & unmappedGlobalIndices, arraySlice1d< globalIndex const, UNIT_STRIDE_DIM > const & localToGlobal ) @@ -412,7 +412,7 @@ localIndex Pack( char * & buffer, template< typename SORTED > inline -localIndex Unpack( char const * & buffer, +localIndex Unpack( buffer_unit_type const * & buffer, set< localIndex > & var, set< globalIndex > & unmappedGlobalIndices, mapBase< globalIndex, localIndex, SORTED > const & globalToLocalMap, @@ -445,7 +445,7 @@ localIndex Unpack( char const * & buffer, template< typename SORTED > inline -localIndex Unpack( char const * & buffer, +localIndex Unpack( buffer_unit_type const * & buffer, ArrayOfSets< localIndex > & var, localIndex const setIndex, set< globalIndex > & unmappedGlobalIndices, @@ -480,7 +480,7 @@ localIndex Unpack( char const * & buffer, template< bool DO_PACKING > -localIndex Pack( char * & buffer, +localIndex Pack( buffer_unit_type * & buffer, set< localIndex > const & var, arrayView1d< localIndex const > const & packList, set< globalIndex > const & unmappedGlobalIndices, @@ -518,8 +518,8 @@ localIndex Pack( char * & buffer, template< bool DO_PACKING, typename T, int NDIM, int UNIT_STRIDE_DIM, typename INDEX_TYPE > -typename std::enable_if< bufferOps::is_packable_array< LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > >::value, localIndex >::type -Pack( char * & buffer, +typename std::enable_if< is_packable< T >, localIndex >::type +Pack( buffer_unit_type * & buffer, LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > const & var ) { localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, var.dims(), NDIM ); @@ -534,8 +534,8 @@ Pack( char * & buffer, template< typename T, int NDIM, typename PERMUTATION, typename INDEX_TYPE > -typename std::enable_if< bufferOps::is_packable_array< LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > >::value, localIndex >::type -Unpack( char const * & buffer, LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > & var ) +typename std::enable_if< is_packable< T >, localIndex >::type +Unpack( buffer_unit_type const * & buffer, LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE > & var ) { INDEX_TYPE dims[NDIM]; localIndex sizeOfUnpackedChars = Unpack( buffer, dims, NDIM ); @@ -558,8 +558,8 @@ Unpack( char const * & buffer, LvArray::Array< T, NDIM, PERMUTATION, INDEX_TYPE template< bool DO_PACKING, typename T, int NDIM, int UNIT_STRIDE_DIM, typename T_indices, typename INDEX_TYPE > -typename std::enable_if< bufferOps::is_packable_array< LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > >::value, localIndex >::type -Pack( char * & buffer, +typename std::enable_if< is_packable< T >, localIndex >::type +Pack( buffer_unit_type * & buffer, LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > const & var, const T_indices & indices ) { @@ -576,7 +576,7 @@ Pack( char * & buffer, template< typename T, int NDIM, int UNIT_STRIDE_DIM, typename T_indices, typename INDEX_TYPE > localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, INDEX_TYPE > & var, const T_indices & indices ) { @@ -600,7 +600,7 @@ Unpack( char const * & buffer, template< bool DO_PACKING, typename T, typename INDEX_TYPE > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, LvArray::ArrayOfArrays< T, INDEX_TYPE > const & var ) { localIndex sizeOfPackedChars = 0; @@ -618,7 +618,7 @@ Pack( char * & buffer, template< typename T, typename INDEX_TYPE > localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, LvArray::ArrayOfArrays< T, INDEX_TYPE > & var ) { localIndex sizeOfUnpackedChars = 0; @@ -639,7 +639,7 @@ Unpack( char const * & buffer, template< bool DO_PACKING, typename T, typename INDEX_TYPE > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, LvArray::ArrayOfSets< T, INDEX_TYPE > const & var ) { localIndex sizeOfPackedChars = 0; @@ -656,7 +656,7 @@ Pack( char * & buffer, template< typename T, typename INDEX_TYPE > localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, LvArray::ArrayOfSets< T, INDEX_TYPE > & var ) { LvArray::ArrayOfArrays< T, INDEX_TYPE > varAsArray; @@ -669,7 +669,7 @@ Unpack( char const * & buffer, template< bool DO_PACKING, typename T, typename INDEX_TYPE, typename T_indices > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, LvArray::ArrayOfArrays< T, INDEX_TYPE > const & var, T_indices const & indices ) { @@ -688,7 +688,7 @@ Pack( char * & buffer, template< typename T, typename INDEX_TYPE, typename T_indices > localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, LvArray::ArrayOfArrays< T, INDEX_TYPE > & var, T_indices const & indices ) { @@ -713,7 +713,7 @@ Unpack( char const * & buffer, template< bool DO_PACKING, int UNIT_STRIDE_DIM > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arraySlice1d< localIndex const, UNIT_STRIDE_DIM > const & var, globalIndex const * const unmappedGlobalIndices, localIndex const length, @@ -747,7 +747,7 @@ Pack( char * & buffer, template< typename SORTED > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, localIndex_array & var, array1d< globalIndex > & unmappedGlobalIndices, mapBase< globalIndex, localIndex, SORTED > const & globalToLocalMap ) @@ -788,7 +788,7 @@ Unpack( char const * & buffer, template< typename SORTED > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, ArrayOfArrays< localIndex > & var, localIndex const subArrayIndex, array1d< globalIndex > & unmappedGlobalIndices, @@ -830,7 +830,7 @@ Unpack( char const * & buffer, template< typename SORTED, int UNIT_STRIDE_DIM > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arraySlice1d< localIndex, UNIT_STRIDE_DIM > const & var, array1d< globalIndex > & unmappedGlobalIndices, localIndex const expectedLength, @@ -877,7 +877,7 @@ Unpack( char const * & buffer, template< bool DO_PACKING > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arrayView1d< localIndex const > const & var, arrayView1d< localIndex const > const & indices, arrayView1d< globalIndex const > const & localToGlobalMap, @@ -908,7 +908,7 @@ Pack( char * & buffer, template< typename SORTED0, typename SORTED1 > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arrayView1d< localIndex > & var, array1d< localIndex > const & indices, mapBase< globalIndex, localIndex, SORTED0 > const & globalToLocalMap, @@ -956,7 +956,7 @@ Unpack( char const * & buffer, template< bool DO_PACKING, typename SORTED > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arrayView1d< localIndex_array const > const & var, mapBase< localIndex, array1d< globalIndex >, SORTED > const & unmappedGlobalIndices, arrayView1d< localIndex const > const & indices, @@ -992,7 +992,7 @@ Pack( char * & buffer, template< typename SORTED0, typename SORTED1, typename SORTED2 > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arrayView1d< localIndex_array > & var, array1d< localIndex > & indices, mapBase< localIndex, array1d< globalIndex >, SORTED0 > & unmappedGlobalIndices, @@ -1043,7 +1043,7 @@ Unpack( char const * & buffer, template< bool DO_PACKING, typename SORTED > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, ArrayOfArraysView< localIndex const > const & var, mapBase< localIndex, array1d< globalIndex >, SORTED > const & unmappedGlobalIndices, arrayView1d< localIndex const > const & indices, @@ -1078,7 +1078,7 @@ Pack( char * & buffer, template< bool DO_PACKING, typename SORTED > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, ArrayOfArraysView< localIndex const > const & var, mapBase< localIndex, SortedArray< globalIndex >, SORTED > const & unmappedGlobalIndices, arrayView1d< localIndex const > const & indices, @@ -1114,7 +1114,7 @@ Pack( char * & buffer, template< typename SORTED0, typename SORTED1, typename SORTED2 > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, ArrayOfArrays< localIndex > & var, array1d< localIndex > & indices, mapBase< localIndex, array1d< globalIndex >, SORTED0 > & unmappedGlobalIndices, @@ -1166,7 +1166,7 @@ Unpack( char const * & buffer, template< bool DO_PACKING, typename SORTED > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arrayView1d< set< localIndex > const > const & var, mapBase< localIndex, set< globalIndex >, SORTED > const & unmappedGlobalIndices, arrayView1d< localIndex const > const & indices, @@ -1201,7 +1201,7 @@ Pack( char * & buffer, template< typename SORTED0, typename SORTED1, typename SORTED2 > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arrayView1d< set< localIndex > > & var, localIndex_array & indices, mapBase< localIndex, set< globalIndex >, SORTED0 > & unmappedGlobalIndices, @@ -1253,7 +1253,7 @@ Unpack( char const * & buffer, template< typename SORTED0, typename SORTED1, typename SORTED2 > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, ArrayOfSets< localIndex > & var, localIndex_array & indices, mapBase< localIndex, SortedArray< globalIndex >, SORTED0 > & unmappedGlobalIndices, @@ -1306,7 +1306,7 @@ Unpack( char const * & buffer, template< bool DO_PACKING, int UNIT_STRIDE_DIM0, int UNIT_STRIDE_DIM1 > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arrayView2d< localIndex const, UNIT_STRIDE_DIM0 > const & var, arrayView1d< localIndex > const & indices, arraySlice1d< globalIndex const, UNIT_STRIDE_DIM1 > const & localToGlobalMap ) @@ -1326,7 +1326,7 @@ Pack( char * & buffer, template< typename SORTED, int UNIT_STRIDE_DIM > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arrayView2d< localIndex, UNIT_STRIDE_DIM > const & var, array1d< localIndex > & indices, mapBase< globalIndex, localIndex, SORTED > const & globalToLocalMap ) @@ -1371,7 +1371,7 @@ Unpack( char const * & buffer, template< bool DO_PACKING, typename SORTED, int UNIT_STRIDE_DIM0 > localIndex -Pack( char * & buffer, +Pack( buffer_unit_type * & buffer, arrayView2d< localIndex const, UNIT_STRIDE_DIM0 > const & var, mapBase< localIndex, array1d< globalIndex >, SORTED > const & unmappedGlobalIndices, arrayView1d< localIndex const > const & indices, @@ -1408,7 +1408,7 @@ Pack( char * & buffer, template< typename SORTED0, typename SORTED1, typename SORTED2, int UNIT_STRIDE_DIM > inline localIndex -Unpack( char const * & buffer, +Unpack( buffer_unit_type const * & buffer, arrayView2d< localIndex, UNIT_STRIDE_DIM > const & var, localIndex_array & indices, mapBase< localIndex, array1d< globalIndex >, SORTED0 > & unmappedGlobalIndices, @@ -1463,14 +1463,14 @@ Unpack( char const * & buffer, } -template< bool DO_PACKING, typename T_KEY, typename T_VAL, typename SORTED > -typename std::enable_if< bufferOps::is_packable_map< mapBase< T_KEY, T_VAL, SORTED > >::value, localIndex >::type -Pack( char * & buffer, mapBase< T_KEY, T_VAL, SORTED > const & var ) +template< bool DO_PACKING, typename MAP_TYPE > +typename std::enable_if< is_packable_map< MAP_TYPE >, localIndex >::type +Pack( buffer_unit_type * & buffer, MAP_TYPE const & var ) { - const typename mapBase< T_KEY, T_VAL, SORTED >::size_type length = var.size(); + const typename MAP_TYPE::size_type length = var.size(); localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, length ); - for( typename mapBase< T_KEY, T_VAL, SORTED >::const_iterator i=var.begin() ; i!=var.end() ; ++i ) + for( typename MAP_TYPE::const_iterator i=var.begin() ; i!=var.end() ; ++i ) { sizeOfPackedChars += Pack< DO_PACKING >( buffer, i->first ); sizeOfPackedChars += Pack< DO_PACKING >( buffer, i->second ); @@ -1480,38 +1480,37 @@ Pack( char * & buffer, mapBase< T_KEY, T_VAL, SORTED > const & var ) } -template< typename T_KEY, typename T_VAL, typename SORTED > -typename std::enable_if< bufferOps::is_packable_map< mapBase< T_KEY, T_VAL, SORTED > >::value, localIndex >::type -Unpack( char const * & buffer, mapBase< T_KEY, T_VAL, SORTED > & map ) +template< typename MAP_TYPE > +typename std::enable_if< is_packable_map< MAP_TYPE >, localIndex >::type +Unpack( buffer_unit_type const * & buffer, MAP_TYPE & map ) { map.clear(); - typename mapBase< T_KEY, T_VAL, SORTED >::size_type map_length; + typename MAP_TYPE::size_type map_length; localIndex sizeOfUnpackedChars = Unpack( buffer, map_length ); - for( typename mapBase< T_KEY, T_VAL, SORTED >::size_type a=0 ; a -typename std::enable_if< bufferOps::is_packable_map< mapBase< T_KEY, T_VAL, SORTED > >::value && bufferOps::is_packable_by_index< T_VAL >::value, - localIndex >::type -Pack( char * & buffer, mapBase< T_KEY, T_VAL, SORTED > const & var, T_INDICES const & packIndices ) +template< bool DO_PACKING, typename MAP_TYPE, typename T_INDICES > +typename std::enable_if< is_map_packable_by_index< MAP_TYPE >, localIndex >::type +Pack( buffer_unit_type * & buffer, MAP_TYPE const & var, T_INDICES const & packIndices ) { - const typename mapBase< T_KEY, T_VAL, SORTED >::size_type length = var.size(); + typename MAP_TYPE::size_type const length = var.size(); localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, length ); - for( typename mapBase< T_KEY, T_VAL, SORTED >::const_iterator i=var.begin() ; i!=var.end() ; ++i ) + for( typename MAP_TYPE::const_iterator i=var.begin() ; i!=var.end() ; ++i ) { sizeOfPackedChars += Pack< DO_PACKING >( buffer, i->first ); sizeOfPackedChars += Pack< DO_PACKING >( buffer, i->second, packIndices ); @@ -1521,20 +1520,19 @@ Pack( char * & buffer, mapBase< T_KEY, T_VAL, SORTED > const & var, T_INDICES co } -template< typename T_KEY, typename T_VAL, typename SORTED, typename T_INDICES > -typename std::enable_if< bufferOps::is_packable_map< mapBase< T_KEY, T_VAL, SORTED > >::value && bufferOps::is_packable_by_index< T_VAL >::value, - localIndex >::type -Unpack( char const * & buffer, mapBase< T_KEY, T_VAL, SORTED > & map, T_INDICES const & unpackIndices ) +template< typename MAP_TYPE, typename T_INDICES > +typename std::enable_if< is_map_packable_by_index< MAP_TYPE >, localIndex >::type +Unpack( buffer_unit_type const * & buffer, MAP_TYPE & map, T_INDICES const & unpackIndices ) { map.clear(); - typename mapBase< T_KEY, T_VAL, SORTED >::size_type map_length; + typename MAP_TYPE::size_type map_length; localIndex sizeOfUnpackedChars = Unpack( buffer, map_length ); - for( typename mapBase< T_KEY, T_VAL, SORTED >::size_type a=0 ; a & map, T_INDICES template< bool DO_PACKING, typename T_FIRST, typename T_SECOND > localIndex -Pack( char * & buffer, std::pair< T_FIRST, T_SECOND > const & var ) +Pack( buffer_unit_type * & buffer, std::pair< T_FIRST, T_SECOND > const & var ) { localIndex sizeOfPackedChars = Pack< DO_PACKING >( buffer, var.first ); sizeOfPackedChars += Pack< DO_PACKING >( buffer, var.second ); @@ -1557,7 +1555,7 @@ Pack( char * & buffer, std::pair< T_FIRST, T_SECOND > const & var ) template< typename T_FIRST, typename T_SECOND > localIndex -Unpack( char const * & buffer, std::pair< T_FIRST, T_SECOND > & var ) +Unpack( buffer_unit_type const * & buffer, std::pair< T_FIRST, T_SECOND > & var ) { localIndex sizeOfUnpackedChars = Unpack( buffer, var.first ); sizeOfUnpackedChars += Unpack( buffer, var.second ); diff --git a/src/coreComponents/dataRepository/CMakeLists.txt b/src/coreComponents/dataRepository/CMakeLists.txt index 477a6d9813f..43a8fe84d2e 100644 --- a/src/coreComponents/dataRepository/CMakeLists.txt +++ b/src/coreComponents/dataRepository/CMakeLists.txt @@ -14,6 +14,7 @@ set(dataRepository_headers ReferenceWrapper.hpp RestartFlags.hpp SidreWrapper.hpp + WrapperHelpers.hpp Wrapper.hpp WrapperBase.hpp xmlWrapper.hpp diff --git a/src/coreComponents/dataRepository/DefaultValue.hpp b/src/coreComponents/dataRepository/DefaultValue.hpp index ab0d581bafa..4b85a0d6349 100644 --- a/src/coreComponents/dataRepository/DefaultValue.hpp +++ b/src/coreComponents/dataRepository/DefaultValue.hpp @@ -69,6 +69,7 @@ struct Helper { /// attribute to indicate whether type \p T has a default value static constexpr bool has_default_value = false; + using value_type = void; }; /** diff --git a/src/coreComponents/dataRepository/Group.cpp b/src/coreComponents/dataRepository/Group.cpp index 4d07a3906a9..60fecaba30e 100644 --- a/src/coreComponents/dataRepository/Group.cpp +++ b/src/coreComponents/dataRepository/Group.cpp @@ -18,45 +18,23 @@ #include "codingUtilities/StringUtilities.hpp" #include "common/TimingMacros.hpp" -#ifdef GEOSX_USE_ATK #include "dataRepository/SidreWrapper.hpp" -#include "axom/sidre/core/sidre.hpp" -#endif namespace geosx { namespace dataRepository { -axom::sidre::Group * Group::setSidreGroup( string const & name, - Group * const parent ) +conduit::Node & conduitNodeFromParent( string const & name, Group * const parent ) { - - axom::sidre::Group * sidreParent = nullptr; - axom::sidre::Group * sidreGroup = nullptr; -#ifdef GEOSX_USE_ATK - if( parent==nullptr ) - { - sidreParent = SidreWrapper::dataStore().getRoot(); - } - else - { - sidreParent = parent->m_sidreGroup; - } - - if( sidreParent->hasGroup( name ) ) + if( parent == nullptr ) { - sidreGroup = sidreParent->getGroup( name ); + return rootConduitNode[ name ]; } else { - sidreGroup = sidreParent->createGroup( name ); + return parent->getConduitNode()[ name ]; } - return sidreGroup; -#else - return nullptr; - -#endif } Group::Group( std::string const & name, @@ -68,31 +46,13 @@ Group::Group( std::string const & name, m_capacity( 0 ), m_name( name ), m_restart_flags( RestartFlags::WRITE_AND_READ ), - m_input_flags( InputFlags::INVALID ) -#ifdef GEOSX_USE_ATK - , m_sidreGroup( Group::setSidreGroup( name, parent )) -#endif + m_input_flags( InputFlags::INVALID ), + m_conduitNode( conduitNodeFromParent( name, parent ) ) {} Group::~Group() {} -Group::Group( Group && source ): - m_parent( std::move( source.m_parent ) ), - m_wrappers( std::move( source.m_wrappers ) ), - m_subGroups(), - m_size( source.m_size ), - m_capacity( source.m_capacity ), - m_name( source.m_name ), - m_restart_flags( source.m_restart_flags ), - m_input_flags( InputFlags::INVALID ) -#ifdef GEOSX_USE_ATK - , m_sidreGroup( std::move( source.m_sidreGroup ) ) -#endif -{} - - - Group::CatalogInterface::CatalogType & Group::GetCatalog() { static Group::CatalogInterface::CatalogType catalog; @@ -118,8 +78,9 @@ WrapperBase * Group::registerWrapper( string const & name, void Group::deregisterWrapper( string const & name ) { - m_sidreGroup->destroyView( name ); + GEOS_ERROR_IF( !hasView( name ), "Wrapper " << name << " doesn't exist." ); m_wrappers.erase( name ); + m_conduitNode.remove( name ); } @@ -498,108 +459,62 @@ localIndex Group::Unpack( buffer_unit_type const * & buffer, void Group::prepareToWrite() { -#ifdef GEOSX_USE_ATK if( getRestartFlags() == RestartFlags::NO_WRITE ) { return; } - if( !SidreWrapper::dataStore().hasAttribute( "__sizedFromParent__" )) - { - SidreWrapper::dataStore().createAttributeScalar( "__sizedFromParent__", -1 ); - } - for( auto & pair : m_wrappers ) { pair.second->registerToWrite(); } - if( m_sidreGroup->hasView( "__size__" ) ) - { - m_sidreGroup->getView( "__size__" )->setScalar( m_size ); - } - else - { - m_sidreGroup->createView( "__size__" )->setScalar( m_size ); - } + m_conduitNode[ "__size__" ].set( m_size ); - forSubGroups([]( Group * subGroup ) -> void + forSubGroups([]( Group * subGroup ) { subGroup->prepareToWrite(); } ); -#endif } -void Group::finishWriting() const +void Group::finishWriting() { -#ifdef GEOSX_USE_ATK if( getRestartFlags() == RestartFlags::NO_WRITE ) { return; } - m_sidreGroup->destroyView( "__size__" ); - for( auto & pair : m_wrappers ) { pair.second->finishWriting(); } - forSubGroups([]( const Group * subGroup ) -> void + forSubGroups([]( Group * subGroup ) { subGroup->finishWriting(); } ); -#endif } -void Group::prepareToRead() +void Group::loadFromConduit() { -#ifdef GEOSX_USE_ATK if( getRestartFlags() != RestartFlags::WRITE_AND_READ ) { return; } - axom::sidre::View * temp = m_sidreGroup->getView( "__size__" ); - if( temp != nullptr ) - { - m_size = temp->getScalar(); - m_sidreGroup->destroyView( "__size__" ); - } - - for( auto & pair : m_wrappers ) - { - pair.second->registerToRead(); - } - - forSubGroups([]( Group * subGroup ) -> void - { - subGroup->prepareToRead(); - } ); -#endif -} - - -void Group::finishReading() -{ -#ifdef GEOSX_USE_ATK - if( getRestartFlags() != RestartFlags::WRITE_AND_READ ) - { - return; - } + m_size = m_conduitNode.fetch_child( "__size__" ).value(); for( auto & pair : m_wrappers ) { - pair.second->finishReading(); + pair.second->loadFromConduit(); } - forSubGroups([]( Group * subGroup ) -> void + forSubGroups([]( Group * subGroup ) { - subGroup->finishReading(); + subGroup->loadFromConduit(); } ); -#endif } void Group::postRestartInitializationRecursive( Group * const domain ) diff --git a/src/coreComponents/dataRepository/Group.hpp b/src/coreComponents/dataRepository/Group.hpp index 2bf6387cf0a..9304d71b240 100644 --- a/src/coreComponents/dataRepository/Group.hpp +++ b/src/coreComponents/dataRepository/Group.hpp @@ -28,25 +28,18 @@ #include -#ifndef USE_DYNAMIC_CASTING -/// macro definition to specify whether or not to use dynamic_cast -#define USE_DYNAMIC_CASTING 1; -#endif - #ifndef NOCHARTOSTRING_KEYLOOKUP /// macro definition to enable/disable char * lookups #define NOCHARTOSTRING_KEYLOOKUP 0 #endif -/* Forward declaration of axom::sidre::Group */ -namespace axom +// Forward declaration of conduit::Node +namespace conduit { -namespace sidre -{ -class Group; -} +class Node; } + /** * namespace to encapsulate GEOSX */ @@ -109,7 +102,8 @@ class Group Group() = delete; - Group( Group const & source ) = delete; + Group( Group const & ) = delete; + Group( Group const && ) = delete; Group & operator=( Group const & ) = delete; Group & operator=( Group && ) = delete; @@ -203,11 +197,7 @@ class Group template< typename T > static T group_cast( Group * group ) { -#ifdef USE_DYNAMIC_CASTING - return dynamic_cast< T >( group ); -#else - return static_cast< T >( group ); -#endif + return dynamicCast< T >( group ); } /** @@ -219,11 +209,7 @@ class Group template< typename T > static T group_cast( Group const * group ) { -#ifdef USE_DYNAMIC_CASTING - return dynamic_cast< T >( group ); -#else - return static_cast< T >( group ); -#endif + return dynamicCast< T >( group ); } /** @@ -234,11 +220,7 @@ class Group template< typename T > T group_cast() { -#ifdef USE_DYNAMIC_CASTING - return dynamic_cast< T >( this ); -#else - return static_cast< T >( this ); -#endif + return dynamicCast< T >( this ); } /** @@ -249,11 +231,7 @@ class Group template< typename T > T group_cast() const { -#ifdef USE_DYNAMIC_CASTING - return dynamic_cast< T >( this ); -#else - return static_cast< T >( this ); -#endif + return dynamicCast< T >( this ); } //START_SPHINX_INCLUDE_GET_GROUP @@ -866,11 +844,7 @@ class Group template< typename T, typename LOOKUP_TYPE > Wrapper< T > const * getWrapper( LOOKUP_TYPE const & index ) const { -#ifdef USE_DYNAMIC_CASTING - return dynamic_cast< Wrapper< T > const * >( (m_wrappers[index]) ); -#else - return static_cast< Wrapper< T > const * >( (m_wrappers[index]) ); -#endif + return dynamicCast< Wrapper< T > const * >( m_wrappers[index] ); } template< typename T, typename LOOKUP_TYPE > @@ -925,11 +899,7 @@ class Group GEOS_ERROR( "call to getWrapper results in nullptr and a view does not exist. lookup : " << lookup ); } -#ifdef USE_DYNAMIC_CASTING - return dynamic_cast< T const & >( wrapper->reference() ); -#else - return static_cast< T const & >( wrapper->reference() ); -#endif + return dynamicCast< T const & >( wrapper->reference() ); } @@ -1005,39 +975,15 @@ class Group return m_size; } - axom::sidre::Group * getSidreGroup() + conduit::Node & getConduitNode() { -#ifdef GEOSX_USE_ATK - return m_sidreGroup; -#else - return nullptr; -#endif + return m_conduitNode; } - axom::sidre::Group const * getSidreGroup() const - { -#ifdef GEOSX_USE_ATK - return m_sidreGroup; -#else - return nullptr; -#endif - } - - static axom::sidre::Group * setSidreGroup( string const & name, - Group * const parent ); Group * getParent() { return m_parent; } Group const * getParent() const { return m_parent; } - Group * setParent( Group * const parent ) - { - m_parent = parent; -#ifdef GEOSX_USE_ATK - m_sidreGroup = m_parent->getSidreGroup(); -#endif - - return m_parent; - } localIndex getIndexInParent() const { @@ -1065,11 +1011,9 @@ class Group void prepareToWrite(); - void finishWriting() const; - - void prepareToRead(); + void finishWriting(); - void finishReading(); + void loadFromConduit(); void postRestartInitializationRecursive( Group * const domain ); @@ -1163,11 +1107,8 @@ class Group ///< subsequently all wrappers in this group InputFlags m_input_flags; ///< Input flag for this group -#ifdef GEOSX_USE_ATK - /// Pointer to the sidre group that mirrors this group - axom::sidre::Group * m_sidreGroup; -#endif - + /// Reference to the conduit::Node that mirrors this group + conduit::Node & m_conduitNode; }; @@ -1180,11 +1121,7 @@ template< typename T > T * Group::RegisterGroup( std::string const & name, std::unique_ptr< Group > newObject ) { -#ifdef USE_DYNAMIC_CASTING - return dynamic_cast< T * >( m_subGroups.insert( name, newObject.release(), true ) ); -#else - return static_cast< T * >( m_subGroups.insert( name, newObject.release(), true ) ); -#endif + return dynamicCast< T * >( m_subGroups.insert( name, newObject.release(), true ) ); } @@ -1193,11 +1130,7 @@ T * Group::RegisterGroup( std::string const & name, T * newObject, bool const takeOwnership ) { -#ifdef USE_DYNAMIC_CASTING - return dynamic_cast< T * >( m_subGroups.insert( name, newObject, takeOwnership ) ); -#else - return static_cast< T * >( m_subGroups.insert( name, newObject, takeOwnership ) ); -#endif + return dynamicCast< T * >( m_subGroups.insert( name, newObject, takeOwnership ) ); } @@ -1214,7 +1147,7 @@ Wrapper< TBASE > * Group::registerWrapper( std::string const & name, *rkey = m_wrappers.getIndex( name ); } Wrapper< TBASE > * const rval = getWrapper< TBASE >( name ); - if( rval->sizedFromParent() == 1 && rval->shouldResize()) + if( rval->sizedFromParent() == 1 ) { rval->resize( this->size()); } @@ -1260,7 +1193,7 @@ Wrapper< T > * Group::registerWrapper( std::string const & name, true ); Wrapper< T > * const rval = getWrapper< T >( name ); - if( rval->sizedFromParent() == 1 && rval->shouldResize()) + if( rval->sizedFromParent() == 1 ) { rval->resize( this->size()); } diff --git a/src/coreComponents/dataRepository/SidreWrapper.cpp b/src/coreComponents/dataRepository/SidreWrapper.cpp index b097be18716..2de85043258 100644 --- a/src/coreComponents/dataRepository/SidreWrapper.cpp +++ b/src/coreComponents/dataRepository/SidreWrapper.cpp @@ -16,90 +16,88 @@ * @file SidreWrapper.cpp */ +// Source includes #include "SidreWrapper.hpp" +#include "mpiCommunications/MpiWrapper.hpp" #include "common/TimingMacros.hpp" +#include "fileIO/utils/utils.hpp" -#include -#include - +// TPL includes +#include +#include +#include namespace geosx { namespace dataRepository { -#ifdef GEOSX_USE_ATK -using namespace axom::sidre; -#endif - -SidreWrapper::SidreWrapper() -{} +conduit::Node rootConduitNode; -SidreWrapper::~SidreWrapper() -{} -#ifdef GEOSX_USE_ATK -DataStore & SidreWrapper::dataStore() +std::string writeRootNode( std::string const & rootPath ) { - static DataStore datastore; - return datastore; -} -#endif + std::string rootDirName, rootFileName; + splitPath( rootPath, rootDirName, rootFileName ); + if( MpiWrapper::Comm_rank() == 0 ) + { + conduit::Node root; + root[ "number_of_files" ] = MpiWrapper::Comm_size(); + root[ "file_pattern" ] = rootFileName + "/rank_%07d.hdf5"; -/* Write out a restart file. */ -void SidreWrapper::writeTree( int MPI_PARAM( num_files ), - const std::string & path, - const std::string & protocol, - MPI_Comm MPI_PARAM( comm ) ) -{ -#ifdef GEOSX_USE_ATK - GEOSX_MARK_FUNCTION; -#ifdef GEOSX_USE_MPI - axom::sidre::IOManager ioManager( comm ); - ioManager.write( SidreWrapper::dataStore().getRoot(), num_files, path, protocol ); -#else - SidreWrapper::dataStore().getRoot()->save( path, protocol ); -#endif -#endif + conduit::relay::io::save( root, rootPath + ".root", "hdf5" ); + + axom::utilities::filesystem::makeDirsForPath( rootPath ); + } + + MpiWrapper::Barrier( MPI_COMM_GEOSX ); + + return fmt::sprintf( rootPath + "/rank_%07d.hdf5", MpiWrapper::Comm_rank() ); } -void SidreWrapper::reconstructTree( const std::string & root_path, - const std::string & protocol, - MPI_Comm MPI_PARAM( comm ) ) +std::string readRootNode( std::string const & rootPath ) { -#ifdef GEOSX_USE_ATK - GEOSX_MARK_FUNCTION; - if( !SidreWrapper::dataStore().hasAttribute( "__sizedFromParent__" )) + std::string rankFilePattern; + if( MpiWrapper::Comm_rank() == 0 ) { - SidreWrapper::dataStore().createAttributeScalar( "__sizedFromParent__", -1 ); + conduit::Node node; + conduit::relay::io::load( rootPath + ".root", "hdf5", node ); + + int const nFiles = node.fetch_child( "number_of_files" ).value(); + GEOS_ERROR_IF_NE( nFiles, MpiWrapper::Comm_size() ); + + std::string const filePattern = node.fetch_child( "file_pattern" ).as_string(); + + std::string rootDirName, rootFileName; + splitPath( rootPath, rootDirName, rootFileName ); + + rankFilePattern = rootDirName + "/" + filePattern; + GEOS_LOG_RANK_VAR( rankFilePattern ); } -#ifdef GEOSX_USE_MPI - axom::sidre::IOManager ioManager( comm ); - ioManager.read( SidreWrapper::dataStore().getRoot(), root_path, protocol ); -#else - SidreWrapper::dataStore().getRoot()->load( root_path, protocol ); -#endif -#endif + MpiWrapper::Broadcast( rankFilePattern, 0 ); + return fmt::sprintf( rankFilePattern, MpiWrapper::Comm_rank() ); +} + +/* Write out a restart file. */ +void writeTree( std::string const & path ) +{ + GEOSX_MARK_FUNCTION; + + std::string const filePathForRank = writeRootNode( path ); + GEOS_LOG_RANK( "Writing out restart file at " << filePathForRank ); + conduit::relay::io::save( rootConduitNode, filePathForRank, "hdf5" ); } -/* Load sidre external data. */ -void SidreWrapper::loadExternalData( const std::string & root_path, - MPI_Comm MPI_PARAM( comm ) ) +void loadTree( std::string const & path ) { -#ifdef GEOSX_USE_ATK GEOSX_MARK_FUNCTION; -#ifdef GEOSX_USE_MPI - - axom::sidre::IOManager ioManager( comm ); - ioManager.loadExternalData( SidreWrapper::dataStore().getRoot(), root_path ); -#else - SidreWrapper::dataStore().getRoot()->loadExternalData( root_path ); -#endif -#endif + std::string const filePathForRank = readRootNode( path ); + GEOS_LOG_RANK( "Reading in restart file at " << filePathForRank ); + conduit::relay::io::load( filePathForRank, "hdf5", rootConduitNode ); } } /* end namespace dataRepository */ diff --git a/src/coreComponents/dataRepository/SidreWrapper.hpp b/src/coreComponents/dataRepository/SidreWrapper.hpp index 408a8856c89..06bc7de801c 100644 --- a/src/coreComponents/dataRepository/SidreWrapper.hpp +++ b/src/coreComponents/dataRepository/SidreWrapper.hpp @@ -19,41 +19,77 @@ #ifndef GEOSX_DATAREPOSITORY_SIDREWRAPPER_HPP_ #define GEOSX_DATAREPOSITORY_SIDREWRAPPER_HPP_ +// Source includes #include "common/GeosxConfig.hpp" -#include "mpiCommunications/MpiWrapper.hpp" +#include "common/DataTypes.hpp" -#ifdef GEOSX_USE_ATK -#include "axom/sidre/core/sidre.hpp" -#endif +// TPL includes +#include +// System includes #include +#include + +#define CONDUIT_TYPE_INFO( T, CONDUIT_TYPE ) \ + template<> \ + struct conduitTypeInfo< T > \ + { \ + using type = CONDUIT_TYPE; \ + static constexpr int id = CONDUIT_TYPE ## _ID; \ + static constexpr int sizeOfConduitType = sizeof( type ); \ + static constexpr int numConduitValues = sizeof( T ) / sizeOfConduitType; \ + static_assert( sizeof( T ) % sizeOfConduitType == 0, "T cannot be made made up of CONDUIT_TYPE." ); \ + } namespace geosx { namespace dataRepository { -class SidreWrapper +namespace internal { -public: - SidreWrapper(); - ~SidreWrapper(); -#ifdef GEOSX_USE_ATK - static axom::sidre::DataStore & dataStore(); -#endif +template< typename T > +struct conduitTypeInfo +{}; + +// Native integer types +CONDUIT_TYPE_INFO( char, CONDUIT_NATIVE_CHAR ); +CONDUIT_TYPE_INFO( signed char, CONDUIT_NATIVE_SIGNED_CHAR ); +CONDUIT_TYPE_INFO( unsigned char, CONDUIT_NATIVE_UNSIGNED_CHAR ); + +CONDUIT_TYPE_INFO( short, CONDUIT_NATIVE_SHORT ); +CONDUIT_TYPE_INFO( int, CONDUIT_NATIVE_INT ); +CONDUIT_TYPE_INFO( long, CONDUIT_NATIVE_LONG ); +CONDUIT_TYPE_INFO( long long, CONDUIT_NATIVE_LONG_LONG ); + +CONDUIT_TYPE_INFO( unsigned short, CONDUIT_NATIVE_UNSIGNED_SHORT ); +CONDUIT_TYPE_INFO( unsigned int, CONDUIT_NATIVE_UNSIGNED_INT ); +CONDUIT_TYPE_INFO( unsigned long, CONDUIT_NATIVE_UNSIGNED_LONG ); +CONDUIT_TYPE_INFO( unsigned long long, CONDUIT_NATIVE_UNSIGNED_LONG_LONG ); + +// Native floating point types +CONDUIT_TYPE_INFO( float, CONDUIT_NATIVE_FLOAT ); +CONDUIT_TYPE_INFO( double, CONDUIT_NATIVE_DOUBLE ); + + +// Tensor types +CONDUIT_TYPE_INFO( R1Tensor, CONDUIT_NATIVE_DOUBLE ); +CONDUIT_TYPE_INFO( R2Tensor, CONDUIT_NATIVE_DOUBLE ); +CONDUIT_TYPE_INFO( R2SymTensor, CONDUIT_NATIVE_DOUBLE ); - static void writeTree( int num_files, const std::string & path, const std::string & protocol, MPI_Comm comm ); +} // namespace internal - static void reconstructTree( const std::string & root_path, const std::string & protocol, MPI_Comm comm ); +template< typename T > +using conduitTypeInfo = internal::conduitTypeInfo< std::remove_const_t< std::remove_pointer_t< T > > >; - static void loadExternalData( const std::string & root_path, MPI_Comm comm ); +extern conduit::Node rootConduitNode; -private: +void writeTree( std::string const & path ); -}; +void loadTree( std::string const & path ); -} /* namespace dataRepository */ -} /* namespace geosx */ +} // namespace dataRepository +} // namespace geosx #endif /* GEOSX_DATAREPOSITORY_SIDREWRAPPER_HPP_ */ diff --git a/src/coreComponents/dataRepository/Wrapper.hpp b/src/coreComponents/dataRepository/Wrapper.hpp index a7126c6eeb1..8e85c447dae 100644 --- a/src/coreComponents/dataRepository/Wrapper.hpp +++ b/src/coreComponents/dataRepository/Wrapper.hpp @@ -19,12 +19,12 @@ #ifndef GEOSX_DATAREPOSITORY_WRAPPER_HPP_ #define GEOSX_DATAREPOSITORY_WRAPPER_HPP_ - +// Source inclues +#include "WrapperHelpers.hpp" #include "KeyNames.hpp" #include "IntegerConversion.hpp" #include "common/DataTypes.hpp" #include "SFINAE_Macros.hpp" - #include "Macros.hpp" #include "BufferOps.hpp" #include "RestartFlags.hpp" @@ -34,12 +34,8 @@ #include "cxx-utilities/src/src/StringUtilities.hpp" #include "WrapperBase.hpp" - -#ifdef GEOSX_USE_ATK -#include "axom/sidre/core/sidre.hpp" -#include "SidreWrapper.hpp" -#endif - +// System includes +#include #include #include @@ -233,11 +229,7 @@ class Wrapper : public WrapperBase */ static Wrapper< T > * cast( WrapperBase * const base ) { -#ifdef USE_DYNAMIC_CASTING - return dynamic_cast< Wrapper< T > * >(base); -#else - return static_cast< Wrapper< T > * >(base); -#endif + return dynamicCast< Wrapper< T > * >( base ); } /** @@ -247,11 +239,7 @@ class Wrapper : public WrapperBase */ static Wrapper< T > const * cast( WrapperBase const * const base ) { -#ifdef USE_DYNAMIC_CASTING - return dynamic_cast< Wrapper< T > const * >(base); -#else - return static_cast< Wrapper< T > const * >(base); -#endif + return dynamicCast< Wrapper< T > const * >( base ); } /** @@ -261,11 +249,7 @@ class Wrapper : public WrapperBase */ static Wrapper< T > & cast( WrapperBase & base ) { - if( base.get_typeid() != typeid(T) ) - { - GEOS_ERROR( "invalid cast attempt" ); - } - return static_cast< Wrapper< T > & >(base); + return dynamicCast< Wrapper< T > & >( base ); } /** @@ -275,11 +259,7 @@ class Wrapper : public WrapperBase */ static Wrapper< T > const & cast( WrapperBase const & base ) { - if( base.get_typeid() != typeid(T) ) - { - GEOS_ERROR( "invalid cast attempt" ); - } - return static_cast< Wrapper< T > const & >(base); + return dynamicCast< Wrapper< T > const & >( base ); } /** @@ -288,7 +268,7 @@ class Wrapper : public WrapperBase */ virtual bool isPackable() const override final { - return bufferOps::is_packable< T >::value; + return bufferOps::is_packable< T >; } /** @@ -296,7 +276,7 @@ class Wrapper : public WrapperBase * @param buffer the buffer in which to pack T * @return number of packed bytes. */ - virtual localIndex Pack( char * & buffer ) const override final + virtual localIndex Pack( buffer_unit_type * & buffer ) const override final { localIndex packedSize = 0; @@ -312,11 +292,11 @@ class Wrapper : public WrapperBase * @param packList indices of T to pack * @return number of packed bytes. */ - virtual localIndex Pack( char * & buffer, arrayView1d< localIndex const > const & packList ) const override final + virtual localIndex Pack( buffer_unit_type * & buffer, arrayView1d< localIndex const > const & packList ) const override final { localIndex packedSize = 0; - static_if( bufferOps::is_packable_by_index< T >::value ) + static_if( bufferOps::is_packable_by_index< T > ) { if( sizedFromParent()==1 ) { @@ -334,7 +314,7 @@ class Wrapper : public WrapperBase */ virtual localIndex PackSize( ) const override final { - char * buffer = nullptr; + buffer_unit_type * buffer = nullptr; localIndex packedSize = 0; packedSize += bufferOps::Pack< false >( buffer, this->getName() ); @@ -351,10 +331,10 @@ class Wrapper : public WrapperBase virtual localIndex PackSize( arrayView1d< localIndex const > const & packList ) const override final { - char * buffer = nullptr; + buffer_unit_type * buffer = nullptr; localIndex packedSize = 0; - static_if( bufferOps::is_packable_by_index< T >::value ) + static_if( bufferOps::is_packable_by_index< T > ) { if( sizedFromParent()==1 ) { @@ -372,7 +352,7 @@ class Wrapper : public WrapperBase * @param buffer * @return */ - virtual localIndex Unpack( char const * & buffer ) override final + virtual localIndex Unpack( buffer_unit_type const * & buffer ) override final { localIndex unpackedSize = 0; string name; @@ -381,10 +361,11 @@ class Wrapper : public WrapperBase unpackedSize += bufferOps::Unpack( buffer, *m_data ); return unpackedSize; } - virtual localIndex Unpack( char const * & buffer, arrayView1d< localIndex const > const & unpackIndices ) override final + + virtual localIndex Unpack( buffer_unit_type const * & buffer, arrayView1d< localIndex const > const & unpackIndices ) override final { localIndex unpackedSize = 0; - static_if( bufferOps::is_packable_by_index< T >::value ) + static_if( bufferOps::is_packable_by_index< T > ) { if( sizedFromParent()==1 ) { @@ -404,15 +385,14 @@ class Wrapper : public WrapperBase /// @cond DO_NOT_DOCUMENT struct empty_wrapper { - HAS_MEMBER_FUNCTION( empty, bool, const, , ) template< class U = T > - static typename std::enable_if< has_memberfunction_empty< U >::value, bool >::type + static typename std::enable_if< traits::has_empty_method< U >, bool >::type empty( Wrapper< T > const * parent ) { return parent->m_data->empty(); } template< class U = T > - static typename std::enable_if< !has_memberfunction_empty< U >::value, bool >::type + static typename std::enable_if< !traits::has_empty_method< U >, bool >::type empty( Wrapper< T > const * parent ) { return parent; @@ -423,39 +403,9 @@ class Wrapper : public WrapperBase return empty_wrapper::empty( this ); } - /// @cond DO_NOT_DOCUMENT - struct size_wrapper - { - HAS_MEMBER_FUNCTION_VARIANT( size, 0, int, const, , ) - HAS_MEMBER_FUNCTION_VARIANT( size, 1, unsigned int, const, , ) - HAS_MEMBER_FUNCTION_VARIANT( size, 2, long int, const, , ) - HAS_MEMBER_FUNCTION_VARIANT( size, 3, unsigned long int, const, , ) - HAS_MEMBER_FUNCTION_VARIANT( size, 4, long long, const, , ) - HAS_MEMBER_FUNCTION_VARIANT( size, 5, unsigned long long, const, , ) - - template< class U = T > - static typename std::enable_if< has_memberfunction_v0_size< U >::value || - has_memberfunction_v1_size< U >::value || - has_memberfunction_v2_size< U >::value || - has_memberfunction_v3_size< U >::value || - has_memberfunction_v4_size< U >::value || - has_memberfunction_v5_size< U >::value, localIndex >::type - size( Wrapper< T > const * parent ) - { return static_cast< localIndex >(parent->m_data->size()); } - - template< class U = T > - static typename std::enable_if< !(has_memberfunction_v0_size< U >::value || - has_memberfunction_v1_size< U >::value || - has_memberfunction_v2_size< U >::value || - has_memberfunction_v3_size< U >::value || - has_memberfunction_v4_size< U >::value || - has_memberfunction_v5_size< U >::value), localIndex >::type - size( Wrapper< T > const * GEOSX_UNUSED_ARG( parent ) ) - { return 1; } - };/// @endcond DO_NOT_DOCUMENT virtual localIndex size() const override final { - return size_wrapper::size( this ); + return wrapperHelpers::size( *m_data ); } @@ -482,31 +432,14 @@ class Wrapper : public WrapperBase /// @cond DO_NOT_DOCUMENT struct dimension_size_wrapper { - HAS_MEMBER_FUNCTION_VARIANT( size, 0, int, const, VA_LIST( int ), VA_LIST( int(1)) ) - HAS_MEMBER_FUNCTION_VARIANT( size, 1, unsigned int, const, VA_LIST( int ), VA_LIST( int(1)) ) - HAS_MEMBER_FUNCTION_VARIANT( size, 2, long int, const, VA_LIST( int ), VA_LIST( int(1)) ) - HAS_MEMBER_FUNCTION_VARIANT( size, 3, unsigned long int, , VA_LIST( int ), VA_LIST( int(1)) ) - HAS_MEMBER_FUNCTION_VARIANT( size, 4, long long, const, VA_LIST( int ), VA_LIST( int(1)) ) - HAS_MEMBER_FUNCTION_VARIANT( size, 5, unsigned long long, const, VA_LIST( int ), VA_LIST( int(1)) ) - template< class U = T > - static typename std::enable_if< has_memberfunction_v0_size< U >::value || - has_memberfunction_v1_size< U >::value || - has_memberfunction_v2_size< U >::value || - has_memberfunction_v3_size< U >::value || - has_memberfunction_v4_size< U >::value || - has_memberfunction_v5_size< U >::value, localIndex >::type + static typename std::enable_if< traits::has_dimension_size_method< U >, localIndex >::type size( Wrapper< T > const * const parent, int const i ) { return integer_conversion< localIndex >( parent->m_data->size( i )); } template< class U = T > - static typename std::enable_if< !(has_memberfunction_v0_size< U >::value || - has_memberfunction_v1_size< U >::value || - has_memberfunction_v2_size< U >::value || - has_memberfunction_v3_size< U >::value || - has_memberfunction_v4_size< U >::value || - has_memberfunction_v5_size< U >::value), localIndex >::type - size( WrapperBase const * const parent, int const i ) + static typename std::enable_if< !traits::has_dimension_size_method< U >, localIndex >::type + size( Wrapper< T > const * const parent, int const i ) { if( i != 0 ) { @@ -521,32 +454,8 @@ class Wrapper : public WrapperBase return dimension_size_wrapper::size( this, i ); } - - /// @cond DO_NOT_DOCUMENT - struct resize_dimension_wrapper - { - HAS_MEMBER_FUNCTION( resize, void, , VA_LIST( int, localIndex const * ), - VA_LIST( int(1), static_cast< localIndex const * >(nullptr))) - - template< class U=T > - static typename std::enable_if< has_memberfunction_resize< U >::value, void >::type - resize( Wrapper< T > * parent, int num_dims, localIndex const * const dims ) - { parent->m_data->resize( num_dims, dims ); } - - template< class U=T > - static typename std::enable_if< !has_memberfunction_resize< U >::value, void >::type - resize( WrapperBase * parent, int num_dims, localIndex const * const dims ) - { - if( num_dims != 1 ) - { - GEOS_ERROR( "Data is only 1D" ); - return; - } - parent->resize( integer_conversion< localIndex >( dims[0] )); - } - };/// @endcond DO_NOT_DOCUMENT - virtual void resize( int num_dims, localIndex const * const dims ) override final - { resize_dimension_wrapper::resize( this, num_dims, dims ); } + virtual void resize( int ndims, localIndex const * const dims ) override final + { wrapperHelpers::resizeDimensions( *m_data, ndims, dims ); } /// @cond DO_NOT_DOCUMENT struct reserve_wrapper @@ -567,9 +476,6 @@ class Wrapper : public WrapperBase { reserve_wrapper::reserve( this, new_cap ); } -// CONDITIONAL_VIRTUAL_FUNCTION( Wrapper,reserve , void,, -// VA_LIST(std::size_t a), VA_LIST(a) ) - HAS_MEMBER_FUNCTION( capacity, std::size_t, const, , ) CONDITIONAL_VIRTUAL_FUNCTION0( Wrapper< T >, capacity, std::size_t, const ) @@ -583,117 +489,23 @@ class Wrapper : public WrapperBase HAS_MEMBER_FUNCTION( insert, void, , , ) CONDITIONAL_VIRTUAL_FUNCTION0( Wrapper< T >, insert, void, ) - - /// @cond DO_NOT_DOCUMENT - struct resize_wrapper - { - template< typename UU > - struct has_memberfunction_resize - { - HAS_MEMBER_FUNCTION_VARIANT( resize, 0, void, , VA_LIST( int ), VA_LIST( static_cast< int >(1))) - HAS_MEMBER_FUNCTION_VARIANT( resize, 1, void, , VA_LIST( unsigned int ), VA_LIST( static_cast< unsigned int >(1))) - HAS_MEMBER_FUNCTION_VARIANT( resize, 2, void, , VA_LIST( long ), VA_LIST( static_cast< long int >(1))) - HAS_MEMBER_FUNCTION_VARIANT( resize, 3, void, , VA_LIST( unsigned long ), VA_LIST( static_cast< unsigned long int >(1))) - HAS_MEMBER_FUNCTION_VARIANT( resize, 4, void, , VA_LIST( long long int ), VA_LIST( static_cast< long long int >(1))) - HAS_MEMBER_FUNCTION_VARIANT( resize, 5, void, , VA_LIST( unsigned long long ), VA_LIST( static_cast< unsigned long long >(1))) - - static constexpr bool value = has_memberfunction_v0_resize< UU >::value || - has_memberfunction_v1_resize< UU >::value || - has_memberfunction_v2_resize< UU >::value || - has_memberfunction_v3_resize< UU >::value || - has_memberfunction_v4_resize< UU >::value || - has_memberfunction_v5_resize< UU >::value; - }; - - template< typename UU, typename ENABLE=void > - struct has_memberfunction_resize2 - { - static constexpr bool value = false; - }; - - template< typename UU > - struct has_memberfunction_resize2< UU, typename std::enable_if< DefaultValue< UU >::has_default_value >::type > - { - typedef typename DefaultValue< UU >::value_type DVT; - HAS_MEMBER_FUNCTION_VARIANT( resizeDefault, 0, void, , VA_LIST( int, DVT const & ), VA_LIST( static_cast< int >(1), DVT())) - HAS_MEMBER_FUNCTION_VARIANT( resizeDefault, 1, void, , VA_LIST( unsigned int, DVT const & ), VA_LIST( static_cast< unsigned int >(1), DVT())) - HAS_MEMBER_FUNCTION_VARIANT( resizeDefault, 2, void, , VA_LIST( long, DVT const & ), VA_LIST( static_cast< long int >(1), DVT())) - HAS_MEMBER_FUNCTION_VARIANT( resizeDefault, 3, void, , VA_LIST( unsigned long, DVT const & ), VA_LIST( static_cast< unsigned long int >(1), DVT())) - HAS_MEMBER_FUNCTION_VARIANT( resizeDefault, 4, void, , VA_LIST( long long int, DVT const & ), VA_LIST( static_cast< long long int >(1), DVT())) - HAS_MEMBER_FUNCTION_VARIANT( resizeDefault, 5, void, , VA_LIST( unsigned long long, DVT const & ), VA_LIST( static_cast< unsigned long long >(1), DVT())) - - static constexpr bool value = has_memberfunction_v0_resizeDefault< UU >::value || - has_memberfunction_v1_resizeDefault< UU >::value || - has_memberfunction_v2_resizeDefault< UU >::value || - has_memberfunction_v3_resizeDefault< UU >::value || - has_memberfunction_v4_resizeDefault< UU >::value || - has_memberfunction_v5_resizeDefault< UU >::value; - }; - - template< class U = T > - static typename std::enable_if< has_memberfunction_resize2< U >::value && - DefaultValue< U >::has_default_value, void >::type - resize( Wrapper * const parent, localIndex const new_size ) - { - return parent->m_data->resizeDefault( new_size, parent->m_default.value ); - } - - template< class U = T > - static typename std::enable_if< !(has_memberfunction_resize2< U >::value && - DefaultValue< U >::has_default_value) && - has_memberfunction_resize< U >::value, void >::type - resize( Wrapper * const parent, localIndex const new_size ) - { - return parent->m_data->resize( new_size ); - } - - - template< class U = T > - static typename std::enable_if< !(has_memberfunction_resize2< U >::value && - DefaultValue< U >::has_default_value) && - !has_memberfunction_resize< U >::value, void >::type - resize( Wrapper * const, localIndex ) - { - return; - } - };/// @endcond DO_NOT_DOCUMENT - virtual void resize( localIndex new_size ) override final - { - resize_wrapper::resize( this, new_size ); - } - - /// @cond DO_NOT_DOCUMENT - struct should_resize_wrapper - { - HAS_MEMBER_FUNCTION( isSorted, bool, const, , ) - template< class U = T > - static typename std::enable_if< traits::is_set< U >, bool >::type shouldResize() - { return false; } - - template< class U = T > - static typename std::enable_if< !traits::is_set< U >, bool >::type shouldResize() - { return true; } - };/// @endcond DO_NOT_DOCUMENT - virtual bool shouldResize() const override final + virtual void resize( localIndex const newSize ) override final { - return should_resize_wrapper::shouldResize(); + wrapperHelpers::resizeDefault( *m_data, newSize, m_default ); } /// @cond DO_NOT_DOCUMENT struct copy_wrapper { - HAS_ALIAS( isArray ) - template< class U=T > - static typename std::enable_if< has_alias_isArray< U >::value, void >::type + static typename std::enable_if< traits::is_array< U >, void >::type copy( T * const data, localIndex const sourceIndex, localIndex const destIndex ) { data->copy( destIndex, sourceIndex ); -// (*data)[destIndex] = (*data)[sourceIndex]; } template< class U=T > - static typename std::enable_if< !has_alias_isArray< U >::value, void >::type + static typename std::enable_if< !traits::is_array< U >, void >::type copy( T * const GEOSX_UNUSED_ARG( data ), localIndex const GEOSX_UNUSED_ARG( sourceIndex ), localIndex const GEOSX_UNUSED_ARG( destIndex ) ) {} @@ -706,66 +518,6 @@ class Wrapper : public WrapperBase } } - - /** - * @name Structure to determine return types for data access functions - */ - ///@{ - - /// Invoke macro to generate test to see if type has an alias named "pointer". - /// This will be used to determine if the - /// type is to be treated as an "array" or a single object. - HAS_ALIAS( pointer ) - - /** - * SFINAE specialized structure to control return type based on properties of - * T. - * The default template returns a pointer for all calls to data(). - */ - template< class U=T, - bool HASPOINTERTYPE = has_alias_pointer< U >::value > - struct Get_Type - { - /// pointer type - typedef U * pointer; - - /// pointer to const type - typedef U const * const_pointer; - }; - - /** - * Specialization for case when T has a pointer alias, and it is NOT a - * string. - * In this case, we assume that we are storing an array type. The return type - * is then a reference, unless the - * compilation flag is set such that we require a pointer back (good for - * speed, but no array class convenience). - * The resulting types can both be dereferenced with operator[], so no code - * changes required - * unless array member functions have been called. - */ - template< class U > - struct Get_Type< U, true > - { - /// pointer type - typedef typename U::pointer pointer; - - /// pointer to const type - typedef typename U::const_pointer const_pointer; - }; - - /// the valid pointer type for T - using pointer = typename Get_Type< T >::pointer; - - /// the valid pointer to const type for T - using const_pointer = typename Get_Type< T >::const_pointer; - ///@} - - - HAS_MEMBER_FUNCTION( data, pointer, , , ) - HAS_MEMBER_FUNCTION_VARIANT( data, _const, pointer, const, , ) - - /** * @brief accessor for m_data * @return reference to T @@ -883,76 +635,15 @@ class Wrapper : public WrapperBase return this; } - /** - * @brief Case for if m_data has a member function called "data()" - * @return pointer type specified by T::pointer - */ - template< class U = T > - typename std::enable_if< ( has_memberfunction_data< U >::value || has_memberfunction_v_const_data< U >::value ) && - has_alias_pointer< U >::value && !std::is_same< U, string >::value, typename U::pointer >::type - dataPtr() - { - return m_data->data(); - } - /** - * @brief Case for if m_data has a member function called "data()" - * @return pointer type specified by T::const_pointer - */ - template< class U = T > - typename std::enable_if< ( has_memberfunction_data< U >::value || has_memberfunction_v_const_data< U >::value ) && - has_alias_pointer< U >::value && !std::is_same< U, string >::value, typename U::const_pointer >::type - dataPtr() const + traits::Pointer< T > dataPtr() { - return m_data->data(); + return wrapperHelpers::dataPtr( *m_data ); } - - /** - * @brief Case for if m_data is a string" - * @return pointer type specified by char * - */ - template< class U = T > - typename std::enable_if< std::is_same< U, string >::value, char * >::type - dataPtr() + traits::ConstPointer< T > dataPtr() const { - return const_cast< char * >(m_data->data()); - } - - /** - * @brief Case for if m_data is a string" - * @return pointer type specified by char const * - */ - template< class U = T > - typename std::enable_if< std::is_same< U, string >::value, char const * >::type - dataPtr() const - { - return m_data->data(); - } - - - /** - * @brief case for if m_data does NOT have a member function "data()" - * @return pointer type specified by T * - */ - template< class U = T > - typename std::enable_if< !( has_memberfunction_data< U >::value || has_memberfunction_v_const_data< U >::value )&& - !std::is_same< U, string >::value, U * >::type - dataPtr() - { - return m_data; - } - - /** - * @brief case for if m_data does NOT have a member function "data()" - * @return pointer type specified by T * - */ - template< class U = T > - typename std::enable_if< !( has_memberfunction_data< U >::value || has_memberfunction_v_const_data< U >::value )&& - !std::is_same< U, string >::value, U const * >::type - dataPtr() const - { - return m_data; + return wrapperHelpers::dataPtr( *m_data ); } HAS_MEMBER_FUNCTION( setUserCallBack, @@ -965,7 +656,7 @@ class Wrapper : public WrapperBase typename std::enable_if< has_memberfunction_setUserCallBack< U >::value, void >::type setUserCallBack() { - std::string const path = getSidreView()->getPathName(); + std::string const path = getConduitNode().path(); m_data->setUserCallBack( path ); } @@ -978,21 +669,13 @@ class Wrapper : public WrapperBase struct move_wrapper { - HAS_MEMBER_FUNCTION( move, - void, - , - VA_LIST( chai::ExecutionSpace, bool ), - VA_LIST( chai::CPU, true ) ) - template< class U = T > - static typename std::enable_if< has_memberfunction_move< U >::value, void >::type + static typename std::enable_if< traits::has_chai_move_method< U >, void >::type move( U & data, chai::ExecutionSpace space, bool touch ) - { - data.move( space, touch ); - } + { data.move( space, touch ); } template< class U = T > - static typename std::enable_if< !has_memberfunction_move< U >::value, void >::type + static typename std::enable_if< !traits::has_chai_move_method< U >, void >::type move( U &, chai::ExecutionSpace, bool ) {} }; @@ -1000,15 +683,13 @@ class Wrapper : public WrapperBase virtual void move( chai::ExecutionSpace space, bool touch ) override { return move_wrapper::move( *m_data, space, touch ); } - HAS_ALIAS( value_type ) - /** * @brief function to get the size of T * @return size of T */ template< class U = T > - typename std::enable_if< has_alias_value_type< U >::value, size_t >::type + typename std::enable_if< traits::has_alias_value_type< U >, size_t >::type sizeOfValueType() const { return sizeof(typename T::value_type); @@ -1019,7 +700,7 @@ class Wrapper : public WrapperBase * @return size of T */ template< class U = T > - typename std::enable_if< !has_alias_value_type< U >::value, size_t >::type + typename std::enable_if< !traits::has_alias_value_type< U >, size_t >::type sizeOfValueType() const { return sizeof(T); @@ -1030,37 +711,12 @@ class Wrapper : public WrapperBase return sizeOfValueType(); } - - /** - * @brief case for if U::value_type exists. Returns the size of dataPtr - * @return size of T::value_type - */ - template< class U = T > - typename std::enable_if< has_alias_value_type< U >::value, localIndex >::type - byteSize() const - { - return size() * sizeof(typename T::value_type); - } - - - /** - * @brief case for if U::value_type doesn't exists. Returns the size of dataPtr - * @return size of T::value_type - */ - template< class U = T > - typename std::enable_if< !has_alias_value_type< U >::value, localIndex >::type - byteSize() const - { - return size() * sizeof(T); - } - - /** * @brief case for if U::value_type exists. Returns the size of an element of dataPtr * @return size of T::value_type */ template< class U = T > - typename std::enable_if< has_alias_value_type< U >::value, localIndex >::type + typename std::enable_if< traits::has_alias_value_type< U >, localIndex >::type elementSize() const { return sizeof(typename T::value_type); @@ -1071,7 +727,7 @@ class Wrapper : public WrapperBase * @return size of T::value_type */ template< class U = T > - typename std::enable_if< !has_alias_value_type< U >::value, localIndex >::type + typename std::enable_if< !traits::has_alias_value_type< U >, localIndex >::type elementSize() const { return sizeof(T); @@ -1080,7 +736,7 @@ class Wrapper : public WrapperBase /// case for if U::value_type exists. Returns the typeid of an element of dataPtr template< class U = T > - typename std::enable_if< has_alias_value_type< U >::value, const std::type_info & >::type + typename std::enable_if< traits::has_alias_value_type< U >, const std::type_info & >::type elementTypeID() const { return typeid(typename T::value_type); @@ -1089,316 +745,59 @@ class Wrapper : public WrapperBase /// case for if U::value_type doesn't exists. Returns the typeid of an element of dataPtr template< class U = T > - typename std::enable_if< !has_alias_value_type< U >::value, const std::type_info & >::type + typename std::enable_if< !traits::has_alias_value_type< U >, const std::type_info & >::type elementTypeID() const { return typeid(T); } - /// case for if U::value_type exists. Returns the number of elements given a byte size - template< class U = T > - typename std::enable_if< has_alias_value_type< U >::value, localIndex >::type - numElementsFromByteSize( localIndex d_size ) const - { - return d_size / sizeof(typename T::value_type); - } - - - /// case for if U::value_type doesn't exists. Returns the number of elements - /// given a byte size - template< class U = T > - typename std::enable_if< !has_alias_value_type< U >::value, localIndex >::type - numElementsFromByteSize( localIndex d_size ) const - { - return d_size / sizeof(T); - } - /// @cond DO_NOT_DOCUMENT - virtual bool shouldRegisterDataPtr() const override - { - std::type_index type_index = std::type_index( elementTypeID()); - axom::sidre::TypeID sidre_type_id = rtTypes::toSidreType( type_index ); - return sidre_type_id != axom::sidre::TypeID::NO_TYPE_ID; - } - - - - void registerDataPtr( axom::sidre::View * view ) const override - { -#ifdef GEOSX_USE_ATK - view = (view != nullptr) ? view : getSidreView(); - - localIndex num_elements = size(); - if( num_elements > 0 ) - { - std::type_index type_index = std::type_index( elementTypeID()); - axom::sidre::TypeID sidre_type_id = rtTypes::toSidreType( type_index ); - if( sidre_type_id == axom::sidre::TypeID::NO_TYPE_ID ) - { return; } - - localIndex sidre_size = rtTypes::getSidreSize( type_index ); - localIndex byte_size = byteSize(); - localIndex element_size = elementSize(); - - int ndims = numDimensions(); - axom::sidre::IndexType dims[10]; - for( int dim = 0 ; dim < ndims ; ++dim ) - { - dims[dim] = size( dim ); - } - - if( byte_size > num_elements * sidre_size ) - { - dims[ndims++] = element_size / sidre_size; - } - - void * ptr = const_cast< void * >( static_cast< void const * >( dataPtr() ) ); - view->setExternalDataPtr( sidre_type_id, ndims, dims, ptr ); - } - else - { - unregisterDataPtr( view ); - } -#endif - } - /* Register the pointer to data with the associated sidre::View. */ - void registerToWrite( axom::sidre::View * view=nullptr ) override + void registerToWrite() override { -#ifdef GEOSX_USE_ATK + getConduitNode().reset(); + if( getRestartFlags() == RestartFlags::NO_WRITE ) { - view = (view != nullptr) ? view : getSidreView(); - unregisterDataPtr( view ); return; } move( chai::CPU, false ); - view = (view != nullptr) ? view : getSidreView(); - storeSizedFromParent( view ); - - localIndex num_elements = size(); - if( num_elements > 0 ) - { - std::type_index type_index = std::type_index( elementTypeID()); - axom::sidre::TypeID sidre_type_id = rtTypes::toSidreType( type_index ); - if( sidre_type_id == axom::sidre::TypeID::NO_TYPE_ID ) - { - localIndex byte_size = bufferOps::PackSize( reference()); - char * const buffer = new char[byte_size]; - char * buffer_cpy = buffer; - bufferOps::Pack< true >( buffer_cpy, reference()); - view->setExternalDataPtr( axom::sidre::TypeID::INT8_ID, byte_size, buffer ); - return; - } - - localIndex sidre_size = rtTypes::getSidreSize( type_index ); - localIndex byte_size = byteSize(); - localIndex element_size = elementSize(); - - int ndims = numDimensions(); - axom::sidre::IndexType dims[10]; - for( int dim = 0 ; dim < ndims ; ++dim ) - { - dims[dim] = size( dim ); - } + getConduitNode()[ "__sizedFromParent__" ].set( sizedFromParent() ); - if( byte_size > num_elements * sidre_size ) - { - dims[ndims++] = element_size / sidre_size; - } - - void * ptr = const_cast< void * >(static_cast< void const * >( dataPtr() ) ); - view->setExternalDataPtr( sidre_type_id, ndims, dims, ptr ); - } - else - { - unregisterDataPtr( view ); - } -#endif + wrapperHelpers::pushDataToConduitNode( *m_data, getConduitNode() ); } /* Register the pointer to data with the associated sidre::View. */ - void finishWriting( axom::sidre::View * view=nullptr ) const override + void finishWriting() override { -#ifdef GEOSX_USE_ATK - if( getRestartFlags() == RestartFlags::NO_WRITE ) - { - view = (view != nullptr) ? view : getSidreView(); - unregisterDataPtr( view ); - return; - } - - view = (view != nullptr) ? view : getSidreView(); - view->setAttributeToDefault( "__sizedFromParent__" ); - - if( !view->isExternal() || view->getTotalBytes() == 0 ) - { - return; - } - - std::type_index type_index = std::type_index( elementTypeID()); - axom::sidre::TypeID sidre_type_id = rtTypes::toSidreType( type_index ); - if( sidre_type_id == axom::sidre::TypeID::NO_TYPE_ID ) - { - delete[] static_cast< char * >(view->getVoidPtr()); - } - - unregisterDataPtr( view ); -#endif + getConduitNode().reset(); } - void registerToRead( axom::sidre::View * view=nullptr ) override + void loadFromConduit() override { -#ifdef GEOSX_USE_ATK if( getRestartFlags() != RestartFlags::WRITE_AND_READ ) { - unregisterDataPtr( view ); - return; - } - - view = (view != nullptr) ? view : getSidreView(); - loadSizedFromParent( view ); - if( !view->isExternal() || view->getTotalBytes() == 0 ) - { + getConduitNode().reset(); return; } - std::type_index type_index = std::type_index( elementTypeID()); - axom::sidre::TypeID sidre_type_id = rtTypes::toSidreType( type_index ); - if( sidre_type_id == axom::sidre::TypeID::NO_TYPE_ID ) - { - localIndex byte_size = integer_conversion< localIndex >( view->getTotalBytes()); - char * ptr = new char[byte_size]; - view->setExternalDataPtr( axom::sidre::TypeID::INT8_ID, byte_size, ptr ); - return; - } - - resizeFromSidre( view ); - void * ptr = const_cast< void * >( static_cast< void const * >( dataPtr() ) ); - localIndex sidre_size = rtTypes::getSidreSize( type_index ); - view->setExternalDataPtr( sidre_type_id, byteSize() / sidre_size, ptr ); -#endif - } - - - void finishReading( axom::sidre::View * view ) override - { -#ifdef GEOSX_USE_ATK - if( getRestartFlags() != RestartFlags::WRITE_AND_READ ) - { - view = (view != nullptr) ? view : getSidreView(); - unregisterDataPtr( view ); - return; - } - view = (view != nullptr) ? view : getSidreView(); - if( !view->isExternal() || view->getTotalBytes() == 0 ) - { - return; - } - - std::type_index type_index = std::type_index( elementTypeID()); - axom::sidre::TypeID sidre_type_id = rtTypes::toSidreType( type_index ); - if( sidre_type_id == axom::sidre::TypeID::NO_TYPE_ID ) - { - localIndex const byte_size = integer_conversion< localIndex >( view->getTotalBytes()); - const char * const buffer = static_cast< char * >(view->getVoidPtr()); - const char * buffer_cpy = buffer; - localIndex const bytes_read = bufferOps::Unpack( buffer_cpy, reference()); - GEOS_ERROR_IF( bytes_read != byte_size, bytes_read << " != " << byte_size ); - delete[] buffer; - } - - unregisterDataPtr( view ); -#endif - } - - void unregisterDataPtr( axom::sidre::View * view = nullptr ) const - { -#ifdef GEOSX_USE_ATK - view = (view != nullptr) ? view : getSidreView(); - view->setExternalDataPtr( nullptr ); -#endif - } + setSizedFromParent( getConduitNode()["__sizedFromParent__"].value() ); - void storeSizedFromParent( axom::sidre::View * view = nullptr ) const - { -#ifdef GEOSX_USE_ATK - if( SidreWrapper::dataStore().hasAttribute( "__sizedFromParent__" )) - { - view = (view != nullptr) ? view : getSidreView(); - view->setAttributeScalar( "__sizedFromParent__", sizedFromParent()); - } -#endif - } + wrapperHelpers::pullDataFromConduitNode( *m_data, getConduitNode() ); - void loadSizedFromParent( axom::sidre::View * view = nullptr ) - { -#ifdef GEOSX_USE_ATK - if( SidreWrapper::dataStore().hasAttribute( "__sizedFromParent__" )) - { - view = (view != nullptr) ? view : getSidreView(); - setSizedFromParent( view->getAttributeScalar( "__sizedFromParent__" )); - view->setAttributeToDefault( "__sizedFromParent__" ); - } -#endif + getConduitNode().reset(); } - /** - * - * @param view - */ - void resizeFromSidre( axom::sidre::View * view = nullptr ) - { -#ifdef GEOSX_USE_ATK - view = (view != nullptr) ? view : getSidreView(); - if( view->isExternal()) - { - std::type_index type_index = std::type_index( elementTypeID()); - localIndex sidre_size = rtTypes::getSidreSize( type_index ); - - localIndex byte_size = integer_conversion< localIndex >( view->getTotalBytes()); - localIndex num_elements = numElementsFromByteSize( byte_size ); - - int ndims = view->getNumDimensions(); - axom::sidre::IndexType dims[10]; - view->getShape( ndims, dims ); - if( byte_size > num_elements * sidre_size ) - { - ndims--; - } - - localIndex num_elems_recorded = 1; - for( localIndex i = 0 ; i < ndims ; ++i ) - { - num_elems_recorded *= dims[i]; - } - - if( num_elems_recorded != num_elements ) - { - GEOS_ERROR( "Number of elements recorded not equal to the calculated number: " << - num_elems_recorded << " " << num_elements ); - } - -// long long l_dims[ndims]; - localIndex l_dims[10]; - for( localIndex i = 0 ; i < ndims ; ++i ) - { - l_dims[i] = dims[i]; - } - - resize( ndims, l_dims ); - } -#endif - } /// @endcond DO_NOT_DOCUMENT - /** @name overridden setters + /** + * @name overridden setters * Group of setters that override non-virtual functions in WrapperBase */ ///@{ diff --git a/src/coreComponents/dataRepository/WrapperBase.cpp b/src/coreComponents/dataRepository/WrapperBase.cpp index fb8c64ab443..71bedd29058 100644 --- a/src/coreComponents/dataRepository/WrapperBase.cpp +++ b/src/coreComponents/dataRepository/WrapperBase.cpp @@ -35,23 +35,10 @@ WrapperBase::WrapperBase( std::string const & name, m_plotLevel( PlotLevel::LEVEL_3 ), m_inputFlag( InputFlags::INVALID ), m_description(), - m_registeringObjects() -#ifdef GEOSX_USE_ATK - , m_sidreView( nullptr ) -#endif + m_registeringObjects(), + m_conduitNode( parent->getConduitNode()[ name ] ) { -#ifdef GEOSX_USE_ATK - GEOS_ERROR_IF( parent==nullptr, "parameter WrapperCollection * const parent must not be nullptr" ); - - if( parent->getSidreGroup()->hasView( name ) ) - { - m_sidreView = parent->getSidreGroup()->getView( name ); - } - else - { - m_sidreView = parent->getSidreGroup()->createView( name ); - } -#endif + GEOS_ERROR_IF( parent == nullptr, "Cannot have a view with no parent." ); } @@ -59,16 +46,13 @@ WrapperBase::~WrapperBase() {} -WrapperBase::WrapperBase( WrapperBase && source ): - m_name( std::move( source.m_name ) ), - m_parent( source.m_parent ), - m_sizedFromParent( source.m_sizedFromParent ), - m_restart_flags( source.m_restart_flags ) -#ifdef GEOSX_USE_ATK - , m_sidreView( source.m_sidreView ) -#endif - -{} +// WrapperBase::WrapperBase( WrapperBase && source ): +// m_name( std::move( source.m_name ) ), +// m_parent( source.m_parent ), +// m_sizedFromParent( source.m_sizedFromParent ), +// m_restart_flags( source.m_restart_flags ) +// m_conduitNode( source.m_conduitNode ) +// {} void WrapperBase::resize() { diff --git a/src/coreComponents/dataRepository/WrapperBase.hpp b/src/coreComponents/dataRepository/WrapperBase.hpp index c4574f74f6d..db9f953b4c0 100644 --- a/src/coreComponents/dataRepository/WrapperBase.hpp +++ b/src/coreComponents/dataRepository/WrapperBase.hpp @@ -23,17 +23,9 @@ #include "InputFlags.hpp" #include "RestartFlags.hpp" -#ifndef USE_DYNAMIC_CASTING -/// macro definition to specify whether or not to use dynamic_cast -#define USE_DYNAMIC_CASTING 1; -#endif - -namespace axom +namespace conduit { -namespace sidre -{ -class View; -} +class Node; } @@ -51,11 +43,6 @@ class WrapperBase { public: - /** - * @brief default destructor - */ - virtual ~WrapperBase(); - /** * @brief constructor * @param[in] name name of the object @@ -64,12 +51,22 @@ class WrapperBase explicit WrapperBase( string const & name, Group * const parent ); + WrapperBase() = delete; + WrapperBase( WrapperBase const & ) = delete; + WrapperBase( WrapperBase && ) = delete; + WrapperBase & operator=( WrapperBase const & ) = delete; + WrapperBase & operator=( WrapperBase && ) = delete; + + /** + * @brief default destructor + */ + virtual ~WrapperBase(); /** * @brief move operator * @param[in] source */ - WrapperBase( WrapperBase && source ); + // WrapperBase( WrapperBase && source ); virtual void CopyWrapperAttributes( WrapperBase const & source ); @@ -164,53 +161,29 @@ class WrapperBase virtual void move( chai::ExecutionSpace space, bool touch ) = 0; - /** - * - * @return - */ - virtual bool shouldResize() const = 0; - /** * * @return */ virtual size_t sizeOfType() const = 0; - /** - * - * @return - */ - virtual bool shouldRegisterDataPtr() const = 0; - /** * * @param view */ - virtual void registerDataPtr( axom::sidre::View * view=nullptr ) const = 0; + virtual void registerToWrite() = 0; /** * * @param view */ - virtual void registerToWrite( axom::sidre::View * view=nullptr ) = 0; + virtual void finishWriting() = 0; /** * * @param view */ - virtual void finishWriting( axom::sidre::View * view=nullptr ) const = 0; - - /** - * - * @param view - */ - virtual void registerToRead( axom::sidre::View * view=nullptr ) = 0; - - /** - * - * @param view - */ - virtual void finishReading( axom::sidre::View * view=nullptr ) = 0; + virtual void loadFromConduit() = 0; /** * @brief function to call resize( newsize ) where newsize is taken from the parent Group @@ -235,7 +208,7 @@ class WrapperBase * @param buffer * @return */ - virtual localIndex Pack( char * & buffer ) const = 0; + virtual localIndex Pack( buffer_unit_type * & buffer ) const = 0; /** * @@ -243,7 +216,7 @@ class WrapperBase * @param packList * @return */ - virtual localIndex Pack( char * & buffer, arrayView1d< localIndex const > const & packList ) const = 0; + virtual localIndex Pack( buffer_unit_type * & buffer, arrayView1d< localIndex const > const & packList ) const = 0; /** * @@ -263,7 +236,7 @@ class WrapperBase * @param buffer * @return */ - virtual localIndex Unpack( char const * & buffer ) = 0; + virtual localIndex Unpack( buffer_unit_type const * & buffer ) = 0; /** * @@ -271,7 +244,7 @@ class WrapperBase * @param unpackIndices * @return */ - virtual localIndex Unpack( char const * & buffer, arrayView1d< localIndex const > const & unpackIndices ) = 0; + virtual localIndex Unpack( buffer_unit_type const * & buffer, arrayView1d< localIndex const > const & unpackIndices ) = 0; /** * @@ -310,22 +283,12 @@ class WrapperBase return this; } -#ifdef GEOSX_USE_ATK - /** - * - * @return - */ - axom::sidre::View * getSidreView() const - { - return m_sidreView; - } -#endif /** * * @return */ - PlotLevel getPlotLevel() const {return m_plotLevel;} + PlotLevel getPlotLevel() const { return m_plotLevel; } /** * @@ -430,6 +393,13 @@ class WrapperBase // static int TV_ttf_display_type( const WrapperBase * wrapper); #endif +protected: + + conduit::Node & getConduitNode() + { + return m_conduitNode; + } + private: /// name of the object that is being wrapped @@ -455,17 +425,8 @@ class WrapperBase std::vector< string > m_registeringObjects; - #ifdef GEOSX_USE_ATK - /// a pointer to the corresponding sidre view - axom::sidre::View * m_sidreView; -#endif - - - WrapperBase() = delete; - WrapperBase( WrapperBase const & ) = delete; - WrapperBase & operator=( WrapperBase const & ) = delete; - WrapperBase & operator=( WrapperBase && ) = delete; - + /// a reference to the corresponding conduit::Node + conduit::Node & m_conduitNode; }; } diff --git a/src/coreComponents/dataRepository/WrapperHelpers.hpp b/src/coreComponents/dataRepository/WrapperHelpers.hpp new file mode 100644 index 00000000000..7e5e8190446 --- /dev/null +++ b/src/coreComponents/dataRepository/WrapperHelpers.hpp @@ -0,0 +1,408 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2019 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2019 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2019 Total, S.A + * Copyright (c) 2019- GEOSX Contributors + * All right reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file WrapperHelpers.hpp + */ + +#ifndef GEOSX_DATAREPOSITORY_WRAPPERHELPERS_HPP_ +#define GEOSX_DATAREPOSITORY_WRAPPERHELPERS_HPP_ + +#define RESTART_TYPE_LOGGING 0 + +// Source includes +#include "BufferOps.hpp" +#include "DefaultValue.hpp" +#include "SidreWrapper.hpp" +#include "common/DataTypes.hpp" +#include "common/GeosxMacros.hpp" +#include "codingUtilities/GeosxTraits.hpp" + +// TPL includes +#include + +// System includes +#include + +#if RESTART_TYPE_LOGGING +#include +#endif + +namespace geosx +{ +namespace dataRepository +{ +namespace wrapperHelpers +{ + +inline void logOutputType( std::string const & typeString, std::string const & msg ) +{ +#if RESTART_TYPE_LOGGING + static std::unordered_set< std::string > m_types; + + if( !m_types.count( typeString ) ) + { + m_types.insert( typeString ); + GEOS_LOG( msg << typeString ); + } +#else + GEOSX_DEBUG_VAR( typeString ); + GEOSX_DEBUG_VAR( msg ); +#endif +} + +template< typename T > +inline std::enable_if_t< traits::has_size_method< T >, localIndex > +size( T const & value ) +{ + return integer_conversion< localIndex >( value.size() ); +} + +template< typename T > +inline std::enable_if_t< !traits::has_size_method< T >, localIndex > +size( T const & GEOSX_UNUSED_ARG( value ) ) +{ + return 1; +} + +inline char * dataPtr( std::string & var ) +{ + return const_cast< char * >( var.data() ); +} + +template< typename T > +inline std::enable_if_t< traits::has_data_method< T >, typename traits::Pointer< T > > +dataPtr( T & value ) +{ + return value.data(); +} + +template< typename T > +inline std::enable_if_t< !traits::has_data_method< T >, typename traits::Pointer< T > > +dataPtr( T & value ) +{ + return &value; +} + +template< class T > +inline T const * +dataPtr( SortedArray< T > & value ) +{ + return value.values(); +} + +template< class T > +inline typename traits::ConstPointer< T > +dataPtr( T const & value ) +{ + return dataPtr( const_cast< T & >( value ) ); +} + +template< typename T > +inline std::enable_if_t< traits::has_resize_method< T > > +resize( T & value, localIndex const newSize ) +{ + value.resize( newSize ); +} + +template< typename T > +inline std::enable_if_t< !traits::has_resize_method< T > > +resize( T & GEOSX_UNUSED_ARG( value ), + localIndex const GEOSX_UNUSED_ARG( newSize ) ) +{} + +template< typename T > +inline std::enable_if_t< traits::has_resize_default_method< T, typename DefaultValue< T >::value_type > > +resizeDefault( T & value, localIndex const newSize, DefaultValue< T > const & defaultValue ) +{ + value.resizeDefault( newSize, defaultValue.value ); +} + +template< typename T > +inline std::enable_if_t< !traits::has_resize_default_method< T, typename DefaultValue< T >::value_type > > +resizeDefault( T & value, localIndex const newSize, DefaultValue< T > const & GEOSX_UNUSED_ARG( defaultValue ) ) +{ + resize( value, newSize ); +} + +template< typename T > +inline std::enable_if_t< traits::has_resize_dimensions_method< T > > +resizeDimensions( T & value, int num_dims, localIndex const * const dims ) +{ + value.resize( num_dims, dims ); +} + +template< typename T > +inline std::enable_if_t< !traits::has_resize_dimensions_method< T > > +resizeDimensions( T & value, int num_dims, localIndex const * const dims ) +{ + if( num_dims != 1 ) + { + GEOS_ERROR( "Data is only 1D" ); + return; + } + resize( value, dims[ 0 ] ); +} + +template< typename T > +inline std::enable_if_t< traits::has_alias_value_type< T >, localIndex > +byteSize( T const & value ) +{ + return size( value ) * sizeof( typename T::value_type ); +} + +template< typename T > +inline std::enable_if_t< !traits::has_alias_value_type< T >, localIndex > +byteSize( T const & value ) +{ + return size( value ) * sizeof( T ); +} + +template< typename T > +inline std::enable_if_t< traits::has_alias_value_type< T >, localIndex > +numElementsFromByteSize( localIndex const byteSize ) +{ + GEOS_ERROR_IF_NE( byteSize % sizeof( typename T::value_type ), 0 ); + return byteSize / sizeof( typename T::value_type ); +} + + +template< typename T > +inline std::enable_if_t< !traits::has_alias_value_type< T >, localIndex > +numElementsFromByteSize( localIndex const byteSize ) +{ + GEOS_ERROR_IF_NE( byteSize % sizeof( T ), 0 ); + return byteSize / sizeof( T ); +} + + + +// This is for an object that needs to be packed. +template< typename T > +std::enable_if_t< !bufferOps::can_memcpy< typename traits::Pointer< T > > > +pushDataToConduitNode( T const & var, conduit::Node & node ) +{ + logOutputType( cxx_utilities::demangle< decltype( var ) >(), "Packing for output: " ); + + // Get the number of bytes in the packed object. + localIndex const byteSize = bufferOps::PackSize( var ); + + // Create a conduit data type that describes the array. + conduit::DataType const dtype( conduitTypeInfo< buffer_unit_type >::id, byteSize ); + + // Allocate the array in the "__values__" child. + conduit::Node & valuesNode = node[ "__values__" ]; + valuesNode.set( dtype ); + + // Get the pointer to the array and pack the object into it. + buffer_unit_type * buffer = valuesNode.value(); + bufferOps::Pack< true >( buffer, var ); +} + +// This is for an object that needs to be packed. +template< typename T > +std::enable_if_t< !bufferOps::can_memcpy< typename traits::Pointer< T > > > +pullDataFromConduitNode( T & var, conduit::Node const & node ) +{ + conduit::Node const & valuesNode = node.fetch_child( "__values__" ); + + // Get the number of bytes in the array and a pointer to the array. + localIndex const byteSize = valuesNode.dtype().number_of_elements(); + buffer_unit_type const * buffer = valuesNode.value(); + + // Unpack the object from the array. + localIndex const bytesRead = bufferOps::Unpack( buffer, var ); + GEOS_ERROR_IF_NE( bytesRead, byteSize ); +} + +// This is for an std::string since the type of char is different on different platforms :(. +inline +void +pushDataToConduitNode( std::string const & var, conduit::Node & node ) +{ + logOutputType( cxx_utilities::demangle< decltype( var ) >(), "Output via external pointer: " ); + + constexpr int conduitTypeID = conduitTypeInfo< signed char >::id; + conduit::DataType const dtype( conduitTypeID, var.size() ); + + signed char * const ptr = const_cast< signed char * >( reinterpret_cast< signed char const * >( var.data() ) ); + node[ "__values__" ].set_external( dtype, ptr ); +} + +// This is for an object that doesn't need to be packed but isn't an LvArray. +template< typename T > +std::enable_if_t< bufferOps::can_memcpy< typename traits::Pointer< T > > > +pushDataToConduitNode( T const & var, conduit::Node & node ) +{ + logOutputType( cxx_utilities::demangle< decltype( var ) >(), "Output via external pointer: " ); + + constexpr int conduitTypeID = conduitTypeInfo< typename traits::Pointer< T > >::id; + constexpr int sizeofConduitType = conduitTypeInfo< typename traits::Pointer< T > >::sizeOfConduitType; + localIndex const numBytes = byteSize( var ); + conduit::DataType const dtype( conduitTypeID, numBytes / sizeofConduitType ); + + void * const ptr = const_cast< void * >( static_cast< void const * >( dataPtr( var ) ) ); + node[ "__values__" ].set_external( dtype, ptr ); +} + +// This is for an object that doesn't need to be packed but isn't an LvArray or a SortedArray. +template< typename T > +std::enable_if_t< bufferOps::can_memcpy< typename traits::Pointer< T > > > +pullDataFromConduitNode( T & var, conduit::Node const & node ) +{ + conduit::Node const & valuesNode = node.fetch_child( "__values__" ); + + localIndex const byteSize = integer_conversion< localIndex >( valuesNode.dtype().strided_bytes() ); + localIndex const numElements = numElementsFromByteSize< T >( byteSize ); + + resize( var, numElements ); + + std::memcpy( dataPtr( var ), valuesNode.data_ptr(), byteSize ); +} + +// This is for a SortedArray that doesn't need to be packed. +template< typename T > +std::enable_if_t< bufferOps::can_memcpy< T > > +pullDataFromConduitNode( SortedArray< T > & var, conduit::Node const & node ) +{ + conduit::Node const & valuesNode = node.fetch_child( "__values__" ); + + localIndex const byteSize = integer_conversion< localIndex >( valuesNode.dtype().strided_bytes() ); + localIndex const numElements = numElementsFromByteSize< T >( byteSize ); + + T const * const values = reinterpret_cast< T const * >( valuesNode.data_ptr() ); + var.insertSorted( values, numElements ); +} + + +// This is an LvArray that doesn't need to be packed. +template< typename T, int NDIM, typename PERMUTATION > +std::enable_if_t< bufferOps::can_memcpy< T > > +pushDataToConduitNode( Array< T, NDIM, PERMUTATION > const & var, + conduit::Node & node ) +{ + logOutputType( cxx_utilities::demangle< decltype( var ) >(), "Output array via external pointer: " ); + + // Push the data into conduit + constexpr int conduitTypeID = conduitTypeInfo< T >::id; + constexpr int sizeofConduitType = conduitTypeInfo< T >::sizeOfConduitType; + conduit::DataType const dtype( conduitTypeID, var.size() * sizeof( T ) / sizeofConduitType ); + void * const ptr = const_cast< void * >( static_cast< void const * >( var.data() ) ); + node[ "__values__" ].set_external( dtype, ptr ); + + // Create a copy of the dimensions + localIndex temp[ NDIM + 1 ]; + for( int i = 0 ; i < NDIM ; ++i ) + { + temp[ i ] = var.size( i ); + } + + // If T is something like a Tensor than there is an extra implicit dimension. + constexpr int const implicitDimensionLength = conduitTypeInfo< T >::numConduitValues; + constexpr bool const hasImplicitDimension = implicitDimensionLength != 1; + constexpr int totalNumDimensions = NDIM + hasImplicitDimension; + if( hasImplicitDimension ) + { + temp[ NDIM ] = implicitDimensionLength; + } + + // push the dimensions into the node + conduit::DataType const dimensionType( conduitTypeInfo< localIndex >::id, totalNumDimensions ); + node[ "__dimensions__" ].set( dimensionType, temp ); + + // Create a copy of the permutation + std::array< camp::idx_t, NDIM > const perm = var.getPermutation(); + for( int i = 0 ; i < NDIM ; ++i ) + { + temp[ i ] = perm[ i ]; + } + + if( hasImplicitDimension ) + { + temp[ NDIM ] = NDIM; + } + + node[ "__permutation__" ].set( dimensionType, temp ); +} + +// This is an LvArray that doesn't need to be packed. +template< typename T, int NDIM, typename PERMUTATION > +std::enable_if_t< bufferOps::can_memcpy< T > > +pullDataFromConduitNode( Array< T, NDIM, PERMUTATION > & var, + conduit::Node const & node ) +{ + // Get the number of dimensions written out, accounting for an implicit dimension and the permutation. + constexpr int const implicitDimensionLength = conduitTypeInfo< T >::numConduitValues; + constexpr bool const hasImplicitDimension = implicitDimensionLength != 1; + constexpr int totalNumDimensions = NDIM + hasImplicitDimension; + + // Check that the permutations match. + conduit::Node const & permutationNode = node.fetch_child( "__permutation__" ); + GEOS_ERROR_IF_NE( permutationNode.dtype().number_of_elements(), totalNumDimensions ); + + std::array< camp::idx_t, NDIM > const permutation = var.getPermutation(); + camp::idx_t const * const permFromConduit = permutationNode.value(); + for( int i = 0 ; i < NDIM ; ++i ) + { + GEOS_ERROR_IF_NE_MSG( permFromConduit[ i ], permutation[ i ], + "The permutation of the data in conduit and the provided Array don't match." ); + } + + if( hasImplicitDimension ) + { + GEOS_ERROR_IF_NE_MSG( permFromConduit[ NDIM ], NDIM, + "The permutation of the data in conduit and the provided Array don't match." ); + } + + // Now pull out the dimensions and resize the array. + conduit::Node const & dimensionNode = node.fetch_child( "__dimensions__" ); + GEOS_ERROR_IF_NE( dimensionNode.dtype().number_of_elements(), totalNumDimensions ); + localIndex const * const dims = dimensionNode.value(); + + if( hasImplicitDimension ) + { + GEOS_ERROR_IF_NE( dims[ NDIM ], implicitDimensionLength ); + } + + var.resize( NDIM, dims ); + + // Finally memcpy + conduit::Node const & valuesNode = node.fetch_child( "__values__" ); + localIndex numBytesFromArray = var.size() * sizeof( T ); + GEOS_ERROR_IF_NE( numBytesFromArray, valuesNode.dtype().strided_bytes() ); + std::memcpy( var.data(), valuesNode.data_ptr(), numBytesFromArray ); +} + +template< typename T > +void pushDataToConduitNode( InterObjectRelation< T > const & var, + conduit::Node & node ) +{ + return pushDataToConduitNode( var.Base(), node ); +} + +template< typename T > +void pullDataFromConduitNode( InterObjectRelation< T > & var, + conduit::Node const & node ) +{ + return pullDataFromConduitNode( var.Base(), node ); +} + + +} // namespace WrapperHelpers +} // namespace dataRepository +} // namespace geosx + +#undef RESTART_TYPE_LOGGING + +#endif // GEOSX_DATAREPOSITORY_WRAPPERHELPERS_HPP_ diff --git a/src/coreComponents/dataRepository/unitTests/CMakeLists.txt b/src/coreComponents/dataRepository/unitTests/CMakeLists.txt index f9bf01dbce3..1286983fc6a 100644 --- a/src/coreComponents/dataRepository/unitTests/CMakeLists.txt +++ b/src/coreComponents/dataRepository/unitTests/CMakeLists.txt @@ -9,6 +9,7 @@ set( dataRepository_tests testSidreExtended.cpp testWrapper.cpp testXmlWrapper.cpp + testBufferOps.cpp ) set( dependencyList dataRepository gtest cxx-utilities managers mpiCommunications mesh wells constitutive meshUtilities ) diff --git a/src/coreComponents/dataRepository/unitTests/testBufferOps.cpp b/src/coreComponents/dataRepository/unitTests/testBufferOps.cpp new file mode 100644 index 00000000000..76ad9319773 --- /dev/null +++ b/src/coreComponents/dataRepository/unitTests/testBufferOps.cpp @@ -0,0 +1,54 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2019 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2019 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2019 Total, S.A + * Copyright (c) 2019- GEOSX Contributors + * All right reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +#include + +#include "dataRepository/BufferOps.hpp" + +using namespace geosx; +using namespace bufferOps; + + +TEST( testGeosxTraits, test_is_noncontainer_type_packable ) +{ + static_assert( is_noncontainer_type_packable< int >, "Should be true." ); + static_assert( is_noncontainer_type_packable< double >, "Should be true." ); + static_assert( is_noncontainer_type_packable< R1Tensor >, "Should be true." ); + static_assert( is_noncontainer_type_packable< string >, "Should be true." ); + + static_assert( !is_noncontainer_type_packable< void >, "Should be false." ); + static_assert( !is_noncontainer_type_packable< array1d< double > >, "Should be false." ); + static_assert( !is_noncontainer_type_packable< set< double > >, "Should be false." ); + static_assert( !is_noncontainer_type_packable< map< string, int > >, "Should be false." ); + static_assert( !is_noncontainer_type_packable< std::pair< string, int > >, "Should be false." ); +} + + +TEST( testGeosxTraits, test_is_array_packable ) +{ + static_assert( is_packable_array< LvArray::Array< double, 2, camp::make_idx_seq< 2 >::type, long int > >, "Should be true." ); + + static_assert( !is_packable_array< LvArray::Array< void, 1, camp::make_idx_seq< 1 >::type, int > >, "Should be false." ); + static_assert( !is_packable_array< int >, "Should be false." ); + static_assert( !is_packable_array< double >, "Should be false." ); + static_assert( !is_packable_array< void >, "Should be false." ); +} + + +TEST( testGeosxTraits, test_is_packable_map ) +{ + static_assert( is_packable_map< map< string, int > >, "Should be true." ); + static_assert( !is_packable_map< map< string, std::pair< int, int > > >, "Should be false" ); + static_assert( is_packable_map< map< string, LvArray::Array< int, 1, camp::make_idx_seq< 1 >::type, int > > >, "Should be true." ); +} diff --git a/src/coreComponents/dataRepository/unitTests/testDefaultValue.cpp b/src/coreComponents/dataRepository/unitTests/testDefaultValue.cpp index 92b5cfe1967..1797f31c676 100644 --- a/src/coreComponents/dataRepository/unitTests/testDefaultValue.cpp +++ b/src/coreComponents/dataRepository/unitTests/testDefaultValue.cpp @@ -36,12 +36,12 @@ TEST( testDefaultValue, testScalar ) TEST( testDefaultValue, testArray ) { - using array1 = array_decl< double, 1 >; - using array2 = array_decl< double, 2 >; - using array3 = array_decl< double, 3 >; - using array4 = array_decl< int, 1 >; - using array5 = array_decl< long int, 1 >; - using array6 = array_decl< long long int, 1 >; + using array1 = Array< double, 1 >; + using array2 = Array< double, 2 >; + using array3 = Array< double, 3 >; + using array4 = Array< int, 1 >; + using array5 = Array< long int, 1 >; + using array6 = Array< long long int, 1 >; EXPECT_TRUE( DefaultValue< array1 >::has_default_value==true ); EXPECT_TRUE( DefaultValue< array2 >::has_default_value==true ); EXPECT_TRUE( DefaultValue< array3 >::has_default_value==true ); diff --git a/src/coreComponents/dataRepository/unitTests/testSidreBasic.cpp b/src/coreComponents/dataRepository/unitTests/testSidreBasic.cpp index 3f3981bf9ce..3aefc216a90 100644 --- a/src/coreComponents/dataRepository/unitTests/testSidreBasic.cpp +++ b/src/coreComponents/dataRepository/unitTests/testSidreBasic.cpp @@ -12,6 +12,7 @@ * ------------------------------------------------------------------------------------------------------------ */ +// Source includes #include "common/DataTypes.hpp" #include "managers/initialization.hpp" #include "dataRepository/Group.hpp" @@ -19,98 +20,253 @@ #include "dataRepository/SidreWrapper.hpp" #include "mpiCommunications/MpiWrapper.hpp" +// TPL includes #include +// System includes +#include +#include + + namespace geosx { namespace dataRepository { -#ifdef GEOSX_USE_ATK -TEST( testSidreBasic, testSidreBasic ) +int rand( int const min, int const max ) { - const string path = "test_sidre_basic"; - const string protocol = "sidre_hdf5"; - const int group_size = 44; - const int sized_from_parent = 55; - const int num_items = 10; - const uint expected_size = num_items * sizeof(globalIndex); - axom::sidre::DataStore & ds = SidreWrapper::dataStore(); + static std::mt19937_64 gen; + return std::uniform_int_distribution< int >( min, max )( gen ); +} - /* Create a new Group directly below the sidre::DataStore root. */ - Group * root = new Group( std::string( "data" ), nullptr ); - root->resize( group_size ); +template< typename T > +void fillValue( T & val ) +{ + val = rand( -100, 100 ); +} + +void fillValue( R1Tensor & val ) +{ + for( int i = 0 ; i < 3 ; ++i ) + { + val[ i ] = rand( -100, 100 ); + } +} - /* Create a Wrapper which creates the associated sidre::View */ - Wrapper< globalIndex_array > * data_view = root->registerWrapper< globalIndex_array >( "globalIndex_data" ); - data_view->setSizedFromParent( sized_from_parent ); +void fillValue( R2Tensor & val ) +{ + for( int i = 0 ; i < 3 ; ++i ) + { + for( int j = 0 ; j < 3 ; ++j ) + { + val( i, j ) = rand( -100, 100 ); + } + } +} - /* Resize the array */ - data_view->resize( num_items ); +void fillValue( std::string & val ) +{ + int const num = rand( -100, 100 ); + val = std::to_string( num ) + + std::string( " The rest of this is to avoid any small string optimizations. " ) + + std::to_string( 2 * num ); +} - /* Check that the Wrapper size and byteSize functions return the proper values */ - EXPECT_EQ( data_view->size(), num_items ); - EXPECT_EQ( data_view->byteSize(), expected_size ); +template< typename T, typename U > +void fillValue( std::pair< T, U > val ) +{ + fillValue( val.first ); + fillValue( val.second ); +} - /* Set the data */ - globalIndex_array & data = data_view->reference(); - for( int i = 0 ; i < num_items ; i++ ) +template< typename T > +void fillValue( std::vector< T > & val ) +{ + val.resize( rand( 0, 30 ) ); + for( T & v : val ) { - data[i] = i; + fillValue( v ); } +} - /* Check that the Wrapper dataPtr points to the right thing */ - globalIndex * dataPtr = data_view->dataPtr(); - EXPECT_EQ( dataPtr, &(data[0])); - for( int i = 0 ; i < data_view->size() ; i++ ) +template< typename T, int NDIM, typename PERMUTATION > +void fillValue( LvArray::Array< T, NDIM, PERMUTATION > & val ) +{ + localIndex dims[ NDIM ]; + for( int i = 0 ; i < NDIM ; ++i ) { - EXPECT_EQ( dataPtr[i], data[i] ); + dims[ i ] = rand( 1, 10 ); } - /* Save the sidre tree */ - root->prepareToWrite(); - SidreWrapper::writeTree( 1, path, protocol, MPI_COMM_GEOSX ); - root->finishWriting(); - - /* Delete geos tree and reset sidre tree. */ - delete root; - ds.destroyAllAttributes(); - ds.destroyAllBuffers(); - ds.getRoot()->destroyGroups(); - - /* Restore the sidre tree */ -#ifdef GEOSX_USE_MPI - string const fileName = path + ".root"; -#else - string const fileName = path; -#endif - SidreWrapper::reconstructTree( fileName, protocol, MPI_COMM_GEOSX ); - root = new Group( std::string( "data" ), nullptr ); - - /* Create dual GEOS tree. Groups automatically register with the associated sidre::View. */ - Wrapper< globalIndex_array > * data_view_new = root->registerWrapper< globalIndex_array >( "globalIndex_data" ); - - /* Load the data */ - root->prepareToRead(); - SidreWrapper::loadExternalData( fileName, MPI_COMM_GEOSX ); - root->finishReading(); - - /* Should be the same as stored. */ - EXPECT_EQ( data_view_new->size(), num_items ); - - globalIndex_array & data_new = data_view_new->reference(); - for( int i = 0 ; i < data_view_new->size() ; i++ ) + val.resize( NDIM, dims ); + + for( localIndex i = 0 ; i < val.size() ; ++i ) { - EXPECT_EQ( data_new[i], i ); + fillValue( val.data()[ i ] ); } +} - EXPECT_EQ( data_view_new->sizedFromParent(), sized_from_parent ); - EXPECT_EQ( root->size(), group_size ); +template< typename T > +void fillValue( SortedArray< T > & val ) +{ + int const nVals = rand( 0, 30 ); + for( int i = 0 ; i < nVals ; ++i ) + { + T v; + fillValue( v ); + val.insert( v ); + } +} - delete root; +template< typename K, typename V, typename SORTED > +void fillValue( mapBase< K, V, SORTED > & val ) +{ + int const nVals = rand( 0, 30 ); + for( int i = 0 ; i < nVals ; ++i ) + { + K k; + V v; + fillValue( k ); + fillValue( v ); + val[ k ] = v; + } +} + + +template< typename T > +void compareValues( T const & val, T const & valFromFile ) +{ + EXPECT_EQ( val, valFromFile ); } -#endif /* GEOSX_USE_ATK */ +template< typename T, int NDIM, typename PERMUTATION > +void compareValues( LvArray::Array< T, NDIM, PERMUTATION > const & val, + LvArray::Array< T, NDIM, PERMUTATION > const & valFromFile ) +{ + ASSERT_EQ( val.size(), valFromFile.size() ); + for( localIndex i = 0 ; i < val.size() ; ++i ) + { + compareValues( val.data()[ i ], valFromFile.data()[ i ] ); + } +} + +template< typename T > +void compareValues( SortedArray< T > const & val, + SortedArray< T > const & valFromFile ) +{ + ASSERT_EQ( val.size(), valFromFile.size() ); + for( localIndex i = 0 ; i < val.size() ; ++i ) + { + compareValues( val[ i ], valFromFile[ i ] ); + } +} + + +template< typename T > +class SingleWrapperTest : public ::testing::Test +{ +public: + + virtual void SetUp() override + { + m_group = new Group( m_groupName, nullptr ); + m_groupSize = rand( 0, 100 ); + m_group->resize( m_groupSize ); + + m_wrapper = m_group->registerWrapper< T >( m_wrapperName ); + m_wrapperSizedFromParent = rand( 0, 100 ); + m_wrapper->setSizedFromParent( m_wrapperSizedFromParent ); + } + + virtual void TearDown() override + { + delete m_group; + } + + void test() + { + T value; + fillValue( value ); + + // Set the value + m_wrapper->reference() = value; + + // Write out the tree + m_group->prepareToWrite(); + writeTree( m_fileName ); + m_group->finishWriting(); + + // Delete geosx tree and reset the conduit tree. + delete m_group; + rootConduitNode.reset(); + + // Load in the tree + loadTree( m_fileName ); + m_group = new Group( m_groupName, nullptr ); + m_wrapper = m_group->registerWrapper< T >( m_wrapperName ); + m_group->loadFromConduit(); + + // Compare metadata + EXPECT_EQ( m_group->size(), m_groupSize ); + EXPECT_EQ( m_wrapper->sizedFromParent(), m_wrapperSizedFromParent ); + + + // Compare the values + compareValues( value, m_wrapper->reference() ); + } + +private: + std::string const m_groupName = "root"; + std::string const m_wrapperName = "wrapper"; + std::string const m_fileName = "testSidreBasic_SingleWrapperTest"; + + Group * m_group; + int m_groupSize; + Wrapper< T > * m_wrapper; + int m_wrapperSizedFromParent; +}; + +using TestTypes = ::testing::Types< int, + double, + R1Tensor, + R2Tensor, + std::pair< int, R1Tensor >, // This should be passed to conduit via an external + // pointer but currently we're packing it. + std::pair< std::string, double >, + std::string, + std::vector< int >, + std::vector< R2Tensor >, + // std::vector< std::string > bufferOps currently can't pack this + array1d< double >, + array1d< R2Tensor >, + array1d< std::string >, + array1d< array1d< double > >, + array1d< array1d< std::string > >, + array2d< double >, + array2d< R2Tensor >, + array2d< std::string >, + array2d< double, RAJA::PERM_JI >, + array2d< R2Tensor, RAJA::PERM_JI >, + array2d< std::string, RAJA::PERM_JI >, + array3d< double >, + array3d< R2Tensor >, + array3d< std::string >, + array3d< double, RAJA::PERM_KJI >, + array3d< R2Tensor, RAJA::PERM_JIK >, + array3d< std::string, RAJA::PERM_IKJ >, + SortedArray< int >, + SortedArray< std::string >, + map< std::string, int >, + unordered_map< std::string, int >, + map< long, int >, + unordered_map< long, int > + >; +TYPED_TEST_CASE( SingleWrapperTest, TestTypes ); + +TYPED_TEST( SingleWrapperTest, WriteAndRead ) +{ + this->test(); +} } /* end namespace dataRepository */ } /* end namespace geosx */ diff --git a/src/coreComponents/dataRepository/unitTests/testSidreExtended.cpp b/src/coreComponents/dataRepository/unitTests/testSidreExtended.cpp index 4a8df406d04..d457e924644 100644 --- a/src/coreComponents/dataRepository/unitTests/testSidreExtended.cpp +++ b/src/coreComponents/dataRepository/unitTests/testSidreExtended.cpp @@ -14,13 +14,10 @@ // Source includes #include "common/DataTypes.hpp" +#include "managers/initialization.hpp" #include "dataRepository/Group.hpp" #include "dataRepository/SidreWrapper.hpp" #include "dataRepository/Wrapper.hpp" -#include "Logger.hpp" -#include "mpiCommunications/MpiWrapper.hpp" - -#include // TPL includes #include @@ -33,7 +30,6 @@ namespace geosx namespace dataRepository { -#ifdef GEOSX_USE_ATK template< typename T > Wrapper< array1d< T > > * createArrayView( Group * parent, const string & name, int sfp, const array1d< T > & data ) @@ -42,12 +38,10 @@ Wrapper< array1d< T > > * createArrayView( Group * parent, const string & name, view->setSizedFromParent( sfp ); /* Resize the array */ - localIndex expected_size = data.size() * sizeof(T); view->resize( data.size()); /* Check that the Wrapper size and byteSize return the proper values */ EXPECT_EQ( view->size(), data.size()); - EXPECT_EQ( view->byteSize(), expected_size ); /* Set the data */ array1d< T > & view_data = view->reference(); @@ -83,7 +77,6 @@ Wrapper< array2d< T > > * createArray2dView( Group * parent, const string & name view->setSizedFromParent( sfp ); /* Resize the array */ - localIndex expected_size = data.size() * sizeof(T); localIndex dims[2]; dims[0] = data.size( 0 ); dims[1] = data.size( 1 ); @@ -93,7 +86,6 @@ Wrapper< array2d< T > > * createArray2dView( Group * parent, const string & name EXPECT_EQ( view->size( 0 ), data.size( 0 )); EXPECT_EQ( view->size( 1 ), data.size( 1 )); EXPECT_EQ( view->size(), data.size()); - EXPECT_EQ( view->byteSize(), expected_size ); /* Set the data */ array2d< T > & view_data = view->reference(); @@ -143,9 +135,7 @@ Wrapper< set< T > > * createSetView( Group * parent, const string & name, view->reference().insert( data.values(), data.size()); /* Check that the Wrapper size and byteSize return the proper values */ - localIndex expected_size = data.size() * sizeof(T); EXPECT_EQ( view->size(), data.size()); - EXPECT_EQ( view->byteSize(), expected_size ); /* Check that the Wrapper dataPtr points to the right thing */ EXPECT_EQ( view->dataPtr(), view->reference().values()); @@ -173,14 +163,11 @@ Wrapper< string > * createStringView( Group * parent, const string & name, Wrapper< string > * view = parent->registerWrapper< string >( name ); view->setSizedFromParent( sfp ); - localIndex expected_size = static_cast< localIndex >(str.size()) * sizeof(char); - /* Set the data */ view->reference() = str; /* Check that the Wrapper size and byteSize return the proper values */ EXPECT_EQ( static_cast< uint >(view->size()), str.size()); - EXPECT_EQ( view->byteSize(), expected_size ); /* Check that the Wrapper dataPtr points to the right thing */ EXPECT_EQ( view->dataPtr(), view->reference().c_str()); @@ -202,11 +189,9 @@ Wrapper< string_array > * createStringArrayView( Group * parent, const string & Wrapper< string_array > * view = parent->registerWrapper< string_array >( name ); view->setSizedFromParent( sfp ); - unsigned long expected_size = arr.size() * sizeof(string); view->resize( static_cast< localIndex >(arr.size())); EXPECT_EQ( static_cast< uint >(view->size()), arr.size()); - EXPECT_EQ( view->byteSize(), expected_size ); string_array & view_data = view->reference(); for( localIndex i = 0 ; i < arr.size() ; ++i ) @@ -242,7 +227,6 @@ Wrapper< T > * createScalarView( Group * parent, const string & name, /* Check that the Wrapper size and byteSize return the proper values */ EXPECT_EQ( view->size(), 1 ); - EXPECT_EQ( view->byteSize(), sizeof(T)); /* Check that the Wrapper dataPtr points to the right thing */ EXPECT_EQ( *(view->dataPtr()), value ); @@ -261,10 +245,8 @@ void checkScalarView( const Wrapper< T > * view, int sfp, const T value ) { TEST( testSidreExtended, testSidreExtended ) { const string path = "test_sidre_extended"; - const string protocol = "sidre_hdf5"; const int group_size = 44; int sfp = 55; - axom::sidre::DataStore & ds = SidreWrapper::dataStore(); /* Create a new Group directly below the sidre::DataStore root. */ Group * root = new Group( std::string( "data" ), nullptr ); @@ -447,17 +429,15 @@ TEST( testSidreExtended, testSidreExtended ) /* Save the sidre tree */ root->prepareToWrite(); - SidreWrapper::writeTree( 1, path, protocol, MPI_COMM_WORLD ); + writeTree( path ); root->finishWriting(); /* Delete geos tree and reset sidre tree. */ delete root; - ds.destroyAllAttributes(); - ds.destroyAllBuffers(); - ds.getRoot()->destroyGroups(); + rootConduitNode.reset(); /* Restore the sidre tree */ - SidreWrapper::reconstructTree( path + ".root", protocol, MPI_COMM_WORLD ); + loadTree( path ); root = new Group( std::string( "data" ), nullptr ); /* Create dual GEOS tree. Groups automatically register with the associated sidre::View. */ @@ -485,9 +465,7 @@ TEST( testSidreExtended, testSidreExtended ) /* Load the data */ - root->prepareToRead(); - SidreWrapper::loadExternalData( path + ".root", MPI_COMM_WORLD ); - root->finishReading(); + root->loadFromConduit(); /* Group sizes should have carried over. */ EXPECT_EQ( root->size(), group_size ); @@ -512,30 +490,22 @@ TEST( testSidreExtended, testSidreExtended ) checkArray2dView( view_real642d_new, view_real642d_sfp, view_real642d_arr ); checkArray2dView( view_r1t2d_new, view_r1t2d_sfp, view_r1t2d_arr ); - delete root; } -#endif /* GEOSX_USE_ATK */ - } /* end namespace dataRepository */ } /* end namespace geosx */ int main( int argc, char * argv[] ) { - geosx::MpiWrapper::Init( &argc, &argv ); -#ifdef GEOSX_USE_MPI - logger::InitializeLogger( MPI_COMM_WORLD ); -#else - logger::InitializeLogger(); -#endif - - int result = 0; testing::InitGoogleTest( &argc, argv ); - result = RUN_ALL_TESTS(); - logger::FinalizeLogger(); - geosx::MpiWrapper::Finalize(); + geosx::basicSetup( argc, argv ); + + int const result = RUN_ALL_TESTS(); + + geosx::basicCleanup(); + return result; } diff --git a/src/coreComponents/dataRepository/xmlWrapper.hpp b/src/coreComponents/dataRepository/xmlWrapper.hpp index be0ce803a88..ff21459ba69 100644 --- a/src/coreComponents/dataRepository/xmlWrapper.hpp +++ b/src/coreComponents/dataRepository/xmlWrapper.hpp @@ -109,7 +109,7 @@ class xmlWrapper static void StringToInputVariable( R1Tensor & target, string value ); template< typename T, int NDIM > - static void StringToInputVariable( array_decl< T, NDIM > & array, string value ); + static void StringToInputVariable( Array< T, NDIM > & array, string value ); ///@} @@ -171,7 +171,7 @@ void xmlWrapper::StringToInputVariable( T & target, string inputValue ) } template< typename T, int NDIM > -void xmlWrapper::StringToInputVariable( array_decl< T, NDIM > & array, string valueString ) +void xmlWrapper::StringToInputVariable( Array< T, NDIM > & array, string valueString ) { cxx_utilities::stringToArray( array, valueString ); } diff --git a/src/coreComponents/fileIO/CMakeLists.txt b/src/coreComponents/fileIO/CMakeLists.txt index f73caccd073..2d2794552ed 100644 --- a/src/coreComponents/fileIO/CMakeLists.txt +++ b/src/coreComponents/fileIO/CMakeLists.txt @@ -3,23 +3,21 @@ # # Specify all headers # -set(fileIO_headers - silo/SiloFile.hpp - vtk/VTKFile.hpp - vtm/VtmFile.hpp - blueprint/Blueprint.hpp - schema/SchemaUtilities.hpp - utils/utils.hpp ) +set( fileIO_headers + silo/SiloFile.hpp + vtk/VTKFile.hpp + vtm/VtmFile.hpp + schema/SchemaUtilities.hpp + utils/utils.hpp ) # # Specify all sources # -set(fileIO_sources - silo/SiloFile.cpp - vtk/VTKFile.cpp - vtm/VtmFile.cpp - schema/SchemaUtilities.cpp - blueprint/Blueprint.cpp ) +set( fileIO_sources + silo/SiloFile.cpp + vtk/VTKFile.cpp + vtm/VtmFile.cpp + schema/SchemaUtilities.cpp ) set( dependencyList common silo hdf5 pugixml RAJA ) diff --git a/src/coreComponents/fileIO/blueprint/Blueprint.cpp b/src/coreComponents/fileIO/blueprint/Blueprint.cpp deleted file mode 100644 index 440943a106a..00000000000 --- a/src/coreComponents/fileIO/blueprint/Blueprint.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* - * ------------------------------------------------------------------------------------------------------------ - * SPDX-License-Identifier: LGPL-2.1-only - * - * Copyright (c) 2018-2019 Lawrence Livermore National Security LLC - * Copyright (c) 2018-2019 The Board of Trustees of the Leland Stanford Junior University - * Copyright (c) 2018-2019 Total, S.A - * Copyright (c) 2019- GEOSX Contributors - * All right reserved - * - * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. - * ------------------------------------------------------------------------------------------------------------ - */ - -#include "common/GeosxConfig.hpp" - -#include "Blueprint.hpp" - -#include "common/DataTypes.hpp" -#include "mesh/ElementRegionManager.hpp" -#include "mesh/NodeManager.hpp" - -#ifdef GEOSX_USE_ATK -#include "axom/sidre/core/sidre.hpp" -#include "conduit_blueprint.hpp" -#include "conduit_relay.hpp" -#endif - -#include -#include -#include -#include - -using namespace axom::sidre; - -namespace geosx -{ - -const std::unordered_map< localIndex, const std::string > Blueprint::numNodesToElemName = -{ - { 1, "point" }, - { 2, "line" }, - { 3, "triangle" }, - { 4, "tet" }, - { 8, "hex" } -}; - - - -Blueprint::Blueprint( const NodeManager& node_manager, - const ElementRegionManager& elem_reg_manager, - const std::string& output_path, - MPI_Comm GEOSX_UNUSED_ARG( comm ), - const std::string& coord_name, - const std::string& topo_name): -#ifdef GEOSX_USE_ATK - m_node_manager( node_manager ), - m_elem_reg_manager( elem_reg_manager ), -// m_comm( comm ), -#endif - m_output_path( output_path ), - m_coord_name( coord_name ), - m_topo_name( topo_name ) -{} - - - -void Blueprint::write( int cycle, - integer const eventCounter ) const -{ -#ifdef GEOSX_USE_ATK - const string mesh_name = "bp_mesh"; - - DataStore ds; - Group* root = ds.getRoot()->createGroup( mesh_name ); - Group* coords = root->createGroup( "coordsets/" + m_coord_name ); - Group* topo = root->createGroup( "topologies/" + m_topo_name ); - Group* fields = root->createGroup( "fields"); - - addNodes( coords, fields ); - addCells( topo, fields ); - - conduit::Node mesh_node; - conduit::Node info; - ds.getRoot()->createNativeLayout( mesh_node ); - if( !conduit::blueprint::verify( "mesh", mesh_node[ mesh_name ], info ) ) - { - std::ostringstream msg; - msg << "does not conform to the blueprint:"; - info.to_json_stream(msg); - GEOS_LOG_RANK(msg.str()); - - GEOS_ERROR(msg.str()); - } - - conduit::Node root_node; - Node & index = root_node[ "blueprint_index" ]; - - conduit::blueprint::mesh::generate_index( mesh_node[ mesh_name ], mesh_name, 1, index[ mesh_name ] ); - - info.reset(); - if ( !conduit::blueprint::mesh::index::verify( index[ mesh_name ], info ) ) - { - std::ostringstream msg; - msg << "index does not conform to the blueprint:"; - info.to_json_stream(msg); - GEOS_LOG_RANK(msg.str()); - - GEOS_ERROR(msg.str()); - } - - - // Build the file-name - char baseFileName[200] = { 0 }; - - sprintf(baseFileName, "_%06d%03d", cycle, eventCounter); - - const std::string root_output_path = m_output_path + baseFileName + ".root"; - const std::string output_path = m_output_path + baseFileName + ".hdf5"; - - root_node[ "protocol/name" ] = "conduit_hdf5"; - root_node[ "protocol/version" ] = "0.1"; - - root_node[ "number_of_files" ] = 1; - root_node[ "number_of_trees" ] = 1; - root_node[ "file_pattern" ] = output_path; - root_node[ "tree_pattern" ] = "/"; - - conduit::relay::io::save( root_node, root_output_path, "hdf5" ); - conduit::relay::io::save( mesh_node, output_path ); -#endif /* GEOSX_USE_ATK */ -} - - -void Blueprint::addNodes( Group* coords, Group* fields ) const -{ -#ifdef GEOSX_USE_ATK - coords->createView( "type" )->setString( "explicit" ); - - const r1_array& position = m_node_manager.referencePosition(); - const localIndex n_nodes = position.size(); - - View* x_view = coords->createView( "values/x" ); - x_view->setExternalDataPtr( const_cast< R1Tensor* >( position.data() ) ); - x_view->apply( axom::sidre::TypeID::DOUBLE_ID, n_nodes, 0, 3 ); - - View* y_view = coords->createView( "values/y" ); - y_view->setExternalDataPtr( const_cast< R1Tensor* >( position.data() ) ); - y_view->apply( axom::sidre::TypeID::DOUBLE_ID, n_nodes, 1, 3 ); - - View* z_view = coords->createView( "values/z" ); - z_view->setExternalDataPtr( const_cast< R1Tensor* >( position.data() ) ); - z_view->apply( axom::sidre::TypeID::DOUBLE_ID, n_nodes, 2, 3 ); - - for ( const std::pair< const std::string, const dataRepository::WrapperBase* >& pair : m_node_manager.wrappers() ) - { - const dataRepository::WrapperBase* view = pair.second; - // if ( view->sizedFromParent() == 1 && - // view->size() > 0 && - // view->shouldRegisterDataPtr() && - // view->getName() != m_node_manager.viewKeys.referencePosition.Key() ) - if ( view->getName() == "Acceleration" || view->getName() == "Mass" ) - { - Group* cur_field_group = fields->createGroup( "nodes_" + view->getName() ); - cur_field_group->createView( "association" )->setString( "vertex" ); - cur_field_group->createView( "topology" )->setString( m_topo_name ); - cur_field_group->createView( "volume_dependent" )->setString( "false" ); - View* data_view = cur_field_group->createGroup( "values" )->createView( "data" ); - view->registerDataPtr( data_view ); - } - } -#endif /* GEOSX_USE_ATK */ -} - - -void Blueprint::addCells( Group* GEOSX_UNUSED_ARG( topo ), Group* GEOSX_UNUSED_ARG( fields ) ) const -{ - GEOSX_DEBUG_VAR( m_elem_reg_manager ); -#ifdef GEOSX_USE_ATK - // if ( m_elem_reg_manager.numCellBlocks() != 1 ) - // { - // GEOS_ERROR( "Blueprint IO currently only works in problems with one cell block." ); - // } - - // const ElementRegionBase* elem_region = m_elem_reg_manager.GetRegion(0); - // const CellElementSubRegion* cell_block = elem_region->GetSubRegion(0); - // const array2d& connectivity = cell_block->nodeList().Base(); - // const localIndex n_cells = connectivity.size(0); - // const localIndex n_nodes_per_cell = connectivity.size(1); - // const std::string& elem_name = this->numNodesToElemName.at( n_nodes_per_cell ); - - // topo->createView( "coordset" )->setString( m_coord_name ); - // topo->createView( "type" )->setString( "unstructured" ); - // Group* elements_group = topo->createGroup( "elements" ); - // elements_group->createView( "shape" )->setString( elem_name ); - - // View* connec_view = elements_group->createView( "connectivity" ); - // connec_view->setExternalDataPtr( const_cast< localIndex* >( connectivity.data() ) ); - // connec_view->apply( detail::SidreTT< localIndex >::id, n_cells * n_nodes_per_cell ); - - // for ( const std::pair< const std::string, const WrapperBase* >& pair : cell_block->wrappers() ) - // { - // const WrapperBase* view = pair.second; - // if ( view->sizedFromParent() == 1 && - // view->size() > 0 && - // view->shouldRegisterDataPtr() && - // view->getName() != CellBlockSubRegion::viewKeyStruct::nodeListString && - // view->getName() != CellBlockSubRegion::viewKeyStruct::edgeListString && - // view->getName() != CellBlockSubRegion::viewKeyStruct::faceListString && - // view->getName() != CellBlockSubRegion::viewKeyStruct::constitutiveGroupingString && - // view->getName() != CellBlockSubRegion::viewKeyStruct::constitutiveMapString && - // view->getName() != CellBlockSubRegion::viewKeyStruct::dNdXString ) - // { - // Group* cur_field_group = fields->createGroup( "cell_" + view->getName() ); - // cur_field_group->createView( "association" )->setString( "element" ); - // cur_field_group->createView( "topology" )->setString( m_topo_name ); - // cur_field_group->createView( "volume_dependent" )->setString( "false" ); - // View* data_view = cur_field_group->createGroup( "values" )->createView( "data" ); - // view->registerDataPtr( data_view ); - // } - // } -#endif /* GEOSX_USE_ATK */ -} - - -} /* end namespace geosx */ diff --git a/src/coreComponents/fileIO/blueprint/Blueprint.hpp b/src/coreComponents/fileIO/blueprint/Blueprint.hpp deleted file mode 100644 index a8e778fb6ed..00000000000 --- a/src/coreComponents/fileIO/blueprint/Blueprint.hpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * ------------------------------------------------------------------------------------------------------------ - * SPDX-License-Identifier: LGPL-2.1-only - * - * Copyright (c) 2018-2019 Lawrence Livermore National Security LLC - * Copyright (c) 2018-2019 The Board of Trustees of the Leland Stanford Junior University - * Copyright (c) 2018-2019 Total, S.A - * Copyright (c) 2019- GEOSX Contributors - * All right reserved - * - * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. - * ------------------------------------------------------------------------------------------------------------ - */ - -#ifndef GEOSX_FILEIO_BLUEPRINT_BLUEPRINT_HPP -#define GEOSX_FILEIO_BLUEPRINT_BLUEPRINT_HPP - -#include "common/DataTypes.hpp" -#include "mpiCommunications/MpiWrapper.hpp" - -#include -#include - -/* Forward declarations */ -namespace axom -{ -namespace sidre -{ -class Group; -} -} - -namespace geosx -{ - - -/* Forward declarations */ -class NodeManager; -class ElementRegionManager; - -class Blueprint -{ -public: - Blueprint( const NodeManager& node_manager, const ElementRegionManager& elem_reg_manager, - const std::string& output_path, MPI_Comm comm, - const std::string& coord_name="coords", const std::string& topo_name="mesh"); - - ~Blueprint() - {} - - void write(int cycle, integer const eventCounter ) const; - -private: - void addNodes(axom::sidre::Group* coords, axom::sidre::Group* fields) const; - - void addCells(axom::sidre::Group* topo, axom::sidre::Group* fields) const; - - - const static std::unordered_map numNodesToElemName; - -#ifdef GEOSX_USE_ATK - const NodeManager& m_node_manager; - const ElementRegionManager& m_elem_reg_manager; -// const MPI_Comm m_comm; -#endif - const std::string m_output_path; - const std::string m_coord_name; - const std::string m_topo_name; -}; - -} /* end namespace geosx */ - -#endif /* GEOSX_FILEIO_BLUEPRINT_BLUEPRINT_HPP */ diff --git a/src/coreComponents/fileIO/schema/docs/BlackOilFluid_other.rst b/src/coreComponents/fileIO/schema/docs/BlackOilFluid_other.rst index 348627aa2f4..d5ec6645315 100644 --- a/src/coreComponents/fileIO/schema/docs/BlackOilFluid_other.rst +++ b/src/coreComponents/fileIO/schema/docs/BlackOilFluid_other.rst @@ -1,28 +1,28 @@ -====================================== =================================================================================== ========================== -Name Type Description -====================================== =================================================================================== ========================== -dPhaseCompFraction_dGlobalCompFraction Array< double, 5, int_seq< long, 0l, 1l, 2l, 3l, 4l >, long, ChaiVector< double > > (no description available) -dPhaseCompFraction_dPressure Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -dPhaseCompFraction_dTemperature Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -dPhaseDensity_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -dPhaseDensity_dPressure real64_array3d (no description available) -dPhaseDensity_dTemperature real64_array3d (no description available) -dPhaseFraction_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -dPhaseFraction_dPressure real64_array3d (no description available) -dPhaseFraction_dTemperature real64_array3d (no description available) -dPhaseViscosity_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -dPhaseViscosity_dPressure real64_array3d (no description available) -dPhaseViscosity_dTemperature real64_array3d (no description available) -dTotalDensity_dGlobalCompFraction real64_array3d (no description available) -dTotalDensity_dPressure real64_array2d (no description available) -dTotalDensity_dTemperature real64_array2d (no description available) -phaseCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -phaseDensity real64_array3d (no description available) -phaseFraction real64_array3d (no description available) -phaseViscosity real64_array3d (no description available) -totalDensity real64_array2d (no description available) -====================================== =================================================================================== ========================== +====================================== ========================================================================= ========================== +Name Type Description +====================================== ========================================================================= ========================== +dPhaseCompFraction_dGlobalCompFraction Array< double, 5, int_seq< long, 0l, 1l, 2l, 3l, 4l >, long, ChaiBuffer > (no description available) +dPhaseCompFraction_dPressure Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +dPhaseCompFraction_dTemperature Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +dPhaseDensity_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +dPhaseDensity_dPressure real64_array3d (no description available) +dPhaseDensity_dTemperature real64_array3d (no description available) +dPhaseFraction_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +dPhaseFraction_dPressure real64_array3d (no description available) +dPhaseFraction_dTemperature real64_array3d (no description available) +dPhaseViscosity_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +dPhaseViscosity_dPressure real64_array3d (no description available) +dPhaseViscosity_dTemperature real64_array3d (no description available) +dTotalDensity_dGlobalCompFraction real64_array3d (no description available) +dTotalDensity_dPressure real64_array2d (no description available) +dTotalDensity_dTemperature real64_array2d (no description available) +phaseCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +phaseDensity real64_array3d (no description available) +phaseFraction real64_array3d (no description available) +phaseViscosity real64_array3d (no description available) +totalDensity real64_array2d (no description available) +====================================== ========================================================================= ========================== diff --git a/src/coreComponents/fileIO/schema/docs/BrooksCoreyBakerRelativePermeability_other.rst b/src/coreComponents/fileIO/schema/docs/BrooksCoreyBakerRelativePermeability_other.rst index 1d1eaf9382b..d66e062fe91 100644 --- a/src/coreComponents/fileIO/schema/docs/BrooksCoreyBakerRelativePermeability_other.rst +++ b/src/coreComponents/fileIO/schema/docs/BrooksCoreyBakerRelativePermeability_other.rst @@ -1,11 +1,11 @@ -=============================== =============================================================================== ========================== -Name Type Description -=============================== =============================================================================== ========================== -dPhaseRelPerm_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -phaseRelPerm real64_array3d (no description available) -phaseTypes integer_array (no description available) -=============================== =============================================================================== ========================== +=============================== ===================================================================== ========================== +Name Type Description +=============================== ===================================================================== ========================== +dPhaseRelPerm_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +phaseRelPerm real64_array3d (no description available) +phaseTypes integer_array (no description available) +=============================== ===================================================================== ========================== diff --git a/src/coreComponents/fileIO/schema/docs/BrooksCoreyCapillaryPressure_other.rst b/src/coreComponents/fileIO/schema/docs/BrooksCoreyCapillaryPressure_other.rst index 1753ccb3bcc..3539973c213 100644 --- a/src/coreComponents/fileIO/schema/docs/BrooksCoreyCapillaryPressure_other.rst +++ b/src/coreComponents/fileIO/schema/docs/BrooksCoreyCapillaryPressure_other.rst @@ -1,12 +1,12 @@ -=================================== =============================================================================== ========================== -Name Type Description -=================================== =============================================================================== ========================== -dPhaseCapPressure_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -phaseCapPressure real64_array3d (no description available) -phaseOrder integer_array (no description available) -phaseTypes integer_array (no description available) -=================================== =============================================================================== ========================== +=================================== ===================================================================== ========================== +Name Type Description +=================================== ===================================================================== ========================== +dPhaseCapPressure_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +phaseCapPressure real64_array3d (no description available) +phaseOrder integer_array (no description available) +phaseTypes integer_array (no description available) +=================================== ===================================================================== ========================== diff --git a/src/coreComponents/fileIO/schema/docs/BrooksCoreyRelativePermeability_other.rst b/src/coreComponents/fileIO/schema/docs/BrooksCoreyRelativePermeability_other.rst index 1d1eaf9382b..d66e062fe91 100644 --- a/src/coreComponents/fileIO/schema/docs/BrooksCoreyRelativePermeability_other.rst +++ b/src/coreComponents/fileIO/schema/docs/BrooksCoreyRelativePermeability_other.rst @@ -1,11 +1,11 @@ -=============================== =============================================================================== ========================== -Name Type Description -=============================== =============================================================================== ========================== -dPhaseRelPerm_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -phaseRelPerm real64_array3d (no description available) -phaseTypes integer_array (no description available) -=============================== =============================================================================== ========================== +=============================== ===================================================================== ========================== +Name Type Description +=============================== ===================================================================== ========================== +dPhaseRelPerm_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +phaseRelPerm real64_array3d (no description available) +phaseTypes integer_array (no description available) +=============================== ===================================================================== ========================== diff --git a/src/coreComponents/fileIO/schema/docs/CompositionalMultiphaseFluid_other.rst b/src/coreComponents/fileIO/schema/docs/CompositionalMultiphaseFluid_other.rst index 348627aa2f4..d5ec6645315 100644 --- a/src/coreComponents/fileIO/schema/docs/CompositionalMultiphaseFluid_other.rst +++ b/src/coreComponents/fileIO/schema/docs/CompositionalMultiphaseFluid_other.rst @@ -1,28 +1,28 @@ -====================================== =================================================================================== ========================== -Name Type Description -====================================== =================================================================================== ========================== -dPhaseCompFraction_dGlobalCompFraction Array< double, 5, int_seq< long, 0l, 1l, 2l, 3l, 4l >, long, ChaiVector< double > > (no description available) -dPhaseCompFraction_dPressure Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -dPhaseCompFraction_dTemperature Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -dPhaseDensity_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -dPhaseDensity_dPressure real64_array3d (no description available) -dPhaseDensity_dTemperature real64_array3d (no description available) -dPhaseFraction_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -dPhaseFraction_dPressure real64_array3d (no description available) -dPhaseFraction_dTemperature real64_array3d (no description available) -dPhaseViscosity_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -dPhaseViscosity_dPressure real64_array3d (no description available) -dPhaseViscosity_dTemperature real64_array3d (no description available) -dTotalDensity_dGlobalCompFraction real64_array3d (no description available) -dTotalDensity_dPressure real64_array2d (no description available) -dTotalDensity_dTemperature real64_array2d (no description available) -phaseCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -phaseDensity real64_array3d (no description available) -phaseFraction real64_array3d (no description available) -phaseViscosity real64_array3d (no description available) -totalDensity real64_array2d (no description available) -====================================== =================================================================================== ========================== +====================================== ========================================================================= ========================== +Name Type Description +====================================== ========================================================================= ========================== +dPhaseCompFraction_dGlobalCompFraction Array< double, 5, int_seq< long, 0l, 1l, 2l, 3l, 4l >, long, ChaiBuffer > (no description available) +dPhaseCompFraction_dPressure Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +dPhaseCompFraction_dTemperature Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +dPhaseDensity_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +dPhaseDensity_dPressure real64_array3d (no description available) +dPhaseDensity_dTemperature real64_array3d (no description available) +dPhaseFraction_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +dPhaseFraction_dPressure real64_array3d (no description available) +dPhaseFraction_dTemperature real64_array3d (no description available) +dPhaseViscosity_dGlobalCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +dPhaseViscosity_dPressure real64_array3d (no description available) +dPhaseViscosity_dTemperature real64_array3d (no description available) +dTotalDensity_dGlobalCompFraction real64_array3d (no description available) +dTotalDensity_dPressure real64_array2d (no description available) +dTotalDensity_dTemperature real64_array2d (no description available) +phaseCompFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +phaseDensity real64_array3d (no description available) +phaseFraction real64_array3d (no description available) +phaseViscosity real64_array3d (no description available) +totalDensity real64_array2d (no description available) +====================================== ========================================================================= ========================== diff --git a/src/coreComponents/fileIO/schema/docs/LinearElasticAnisotropic_other.rst b/src/coreComponents/fileIO/schema/docs/LinearElasticAnisotropic_other.rst index 9ccf06f61bc..59b85206e13 100644 --- a/src/coreComponents/fileIO/schema/docs/LinearElasticAnisotropic_other.rst +++ b/src/coreComponents/fileIO/schema/docs/LinearElasticAnisotropic_other.rst @@ -1,13 +1,13 @@ -================ ===================================================================================== ================================================== -Name Type Description -================ ===================================================================================== ================================================== -DeviatorStress r2Sym_array2d Stress Deviator -MeanStress real64_array2d Mean stress -defaultStiffness StiffnessTensor Default Elastic Stiffness Tensor in Voigt notation -density real64_array2d Material Density -stiffness Array< StiffnessTensor, 1, int_seq< long, 0l >, long, ChaiVector< StiffnessTensor > > Elastic Stiffness Field in Voigt notation -================ ===================================================================================== ================================================== +================ ================================================================== ================================================== +Name Type Description +================ ================================================================== ================================================== +DeviatorStress r2Sym_array2d Stress Deviator +MeanStress real64_array2d Mean stress +defaultStiffness StiffnessTensor Default Elastic Stiffness Tensor in Voigt notation +density real64_array2d Material Density +stiffness Array< StiffnessTensor, 1, int_seq< long, 0l >, long, ChaiBuffer > Elastic Stiffness Field in Voigt notation +================ ================================================================== ================================================== diff --git a/src/coreComponents/fileIO/schema/docs/Outputs.rst b/src/coreComponents/fileIO/schema/docs/Outputs.rst index cd2e8d5902b..6be2dcd38ce 100644 --- a/src/coreComponents/fileIO/schema/docs/Outputs.rst +++ b/src/coreComponents/fileIO/schema/docs/Outputs.rst @@ -1,13 +1,12 @@ -========= ==== ======= ==================== -Name Type Default Description -========= ==== ======= ==================== -Blueprint node :ref:`XML_Blueprint` -ChomboIO node :ref:`XML_ChomboIO` -Restart node :ref:`XML_Restart` -Silo node :ref:`XML_Silo` -VTK node :ref:`XML_VTK` -========= ==== ======= ==================== +======== ==== ======= =================== +Name Type Default Description +======== ==== ======= =================== +ChomboIO node :ref:`XML_ChomboIO` +Restart node :ref:`XML_Restart` +Silo node :ref:`XML_Silo` +VTK node :ref:`XML_VTK` +======== ==== ======= =================== diff --git a/src/coreComponents/fileIO/schema/docs/Outputs_other.rst b/src/coreComponents/fileIO/schema/docs/Outputs_other.rst index f3ce2013ed2..530e1bdd73b 100644 --- a/src/coreComponents/fileIO/schema/docs/Outputs_other.rst +++ b/src/coreComponents/fileIO/schema/docs/Outputs_other.rst @@ -1,13 +1,12 @@ -========= ==== ============================== -Name Type Description -========= ==== ============================== -Blueprint node :ref:`DATASTRUCTURE_Blueprint` -ChomboIO node :ref:`DATASTRUCTURE_ChomboIO` -Restart node :ref:`DATASTRUCTURE_Restart` -Silo node :ref:`DATASTRUCTURE_Silo` -VTK node :ref:`DATASTRUCTURE_VTK` -========= ==== ============================== +======== ==== ============================= +Name Type Description +======== ==== ============================= +ChomboIO node :ref:`DATASTRUCTURE_ChomboIO` +Restart node :ref:`DATASTRUCTURE_Restart` +Silo node :ref:`DATASTRUCTURE_Silo` +VTK node :ref:`DATASTRUCTURE_VTK` +======== ==== ============================= diff --git a/src/coreComponents/fileIO/schema/docs/PoroLinearElasticAnisotropic_other.rst b/src/coreComponents/fileIO/schema/docs/PoroLinearElasticAnisotropic_other.rst index d428c98628c..5a8897816c6 100644 --- a/src/coreComponents/fileIO/schema/docs/PoroLinearElasticAnisotropic_other.rst +++ b/src/coreComponents/fileIO/schema/docs/PoroLinearElasticAnisotropic_other.rst @@ -1,15 +1,15 @@ -==================== ===================================================================================== ================================================== -Name Type Description -==================== ===================================================================================== ================================================== -DeviatorStress r2Sym_array2d Stress Deviator -MeanStress real64_array2d Mean stress -dPVMult_dDensity real64_array2d (no description available) -defaultStiffness StiffnessTensor Default Elastic Stiffness Tensor in Voigt notation -density real64_array2d Material Density -poreVolumeMultiplier real64_array2d (no description available) -stiffness Array< StiffnessTensor, 1, int_seq< long, 0l >, long, ChaiVector< StiffnessTensor > > Elastic Stiffness Field in Voigt notation -==================== ===================================================================================== ================================================== +==================== ================================================================== ================================================== +Name Type Description +==================== ================================================================== ================================================== +DeviatorStress r2Sym_array2d Stress Deviator +MeanStress real64_array2d Mean stress +dPVMult_dDensity real64_array2d (no description available) +defaultStiffness StiffnessTensor Default Elastic Stiffness Tensor in Voigt notation +density real64_array2d Material Density +poreVolumeMultiplier real64_array2d (no description available) +stiffness Array< StiffnessTensor, 1, int_seq< long, 0l >, long, ChaiBuffer > Elastic Stiffness Field in Voigt notation +==================== ================================================================== ================================================== diff --git a/src/coreComponents/fileIO/schema/docs/VanGenuchtenBakerRelativePermeability_other.rst b/src/coreComponents/fileIO/schema/docs/VanGenuchtenBakerRelativePermeability_other.rst index 1d1eaf9382b..d66e062fe91 100644 --- a/src/coreComponents/fileIO/schema/docs/VanGenuchtenBakerRelativePermeability_other.rst +++ b/src/coreComponents/fileIO/schema/docs/VanGenuchtenBakerRelativePermeability_other.rst @@ -1,11 +1,11 @@ -=============================== =============================================================================== ========================== -Name Type Description -=============================== =============================================================================== ========================== -dPhaseRelPerm_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -phaseRelPerm real64_array3d (no description available) -phaseTypes integer_array (no description available) -=============================== =============================================================================== ========================== +=============================== ===================================================================== ========================== +Name Type Description +=============================== ===================================================================== ========================== +dPhaseRelPerm_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +phaseRelPerm real64_array3d (no description available) +phaseTypes integer_array (no description available) +=============================== ===================================================================== ========================== diff --git a/src/coreComponents/fileIO/schema/docs/VanGenuchtenCapillaryPressure_other.rst b/src/coreComponents/fileIO/schema/docs/VanGenuchtenCapillaryPressure_other.rst index 1753ccb3bcc..3539973c213 100644 --- a/src/coreComponents/fileIO/schema/docs/VanGenuchtenCapillaryPressure_other.rst +++ b/src/coreComponents/fileIO/schema/docs/VanGenuchtenCapillaryPressure_other.rst @@ -1,12 +1,12 @@ -=================================== =============================================================================== ========================== -Name Type Description -=================================== =============================================================================== ========================== -dPhaseCapPressure_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiVector< double > > (no description available) -phaseCapPressure real64_array3d (no description available) -phaseOrder integer_array (no description available) -phaseTypes integer_array (no description available) -=================================== =============================================================================== ========================== +=================================== ===================================================================== ========================== +Name Type Description +=================================== ===================================================================== ========================== +dPhaseCapPressure_dPhaseVolFraction Array< double, 4, int_seq< long, 0l, 1l, 2l, 3l >, long, ChaiBuffer > (no description available) +phaseCapPressure real64_array3d (no description available) +phaseOrder integer_array (no description available) +phaseTypes integer_array (no description available) +=================================== ===================================================================== ========================== diff --git a/src/coreComponents/fileIO/schema/docs/WellElementRegionuniqueSubRegion_other.rst b/src/coreComponents/fileIO/schema/docs/WellElementRegionuniqueSubRegion_other.rst index bcb30c33b40..8d644a1aebf 100644 --- a/src/coreComponents/fileIO/schema/docs/WellElementRegionuniqueSubRegion_other.rst +++ b/src/coreComponents/fileIO/schema/docs/WellElementRegionuniqueSubRegion_other.rst @@ -1,25 +1,25 @@ -========================== ========================================================================================== ========================================================= -Name Type Description -========================== ========================================================================================== ========================================================= -domainBoundaryIndicator integer_array (no description available) -elementCenter r1_array (no description available) -elementVolume real64_array (no description available) -ghostRank integer_array (no description available) -globalToLocalMap mapBase< long long, long, integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -nextWellElementIndex localIndex_array (no description available) -nextWellElementIndexGlobal localIndex_array (no description available) -nodeList InterObjectRelation< Array< long, 2, int_seq< long, 0l, 1l >, long, ChaiVector< long > > > (no description available) -topRank integer (no description available) -topWellElementIndex localIndex (no description available) -wellControlsName string (no description available) -ConstitutiveModels node :ref:`DATASTRUCTURE_ConstitutiveModels` -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -wellElementSubRegion node :ref:`DATASTRUCTURE_wellElementSubRegion` -========================== ========================================================================================== ========================================================= +========================== ================================================================================== ========================================================= +Name Type Description +========================== ================================================================================== ========================================================= +domainBoundaryIndicator integer_array (no description available) +elementCenter r1_array (no description available) +elementVolume real64_array (no description available) +ghostRank integer_array (no description available) +globalToLocalMap mapBase< long long, long, integral_constant< bool, false > > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +nextWellElementIndex localIndex_array (no description available) +nextWellElementIndexGlobal localIndex_array (no description available) +nodeList InterObjectRelation< Array< long, 2, int_seq< long, 0l, 1l >, long, ChaiBuffer > > (no description available) +topRank integer (no description available) +topWellElementIndex localIndex (no description available) +wellControlsName string (no description available) +ConstitutiveModels node :ref:`DATASTRUCTURE_ConstitutiveModels` +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +wellElementSubRegion node :ref:`DATASTRUCTURE_wellElementSubRegion` +========================== ================================================================================== ========================================================= diff --git a/src/coreComponents/fileIO/schema/docs/default_other.rst b/src/coreComponents/fileIO/schema/docs/default_other.rst index 4705b88b45d..ebfca7ed32c 100644 --- a/src/coreComponents/fileIO/schema/docs/default_other.rst +++ b/src/coreComponents/fileIO/schema/docs/default_other.rst @@ -1,26 +1,26 @@ -================================ ============================================================================================================================================================================================================ ============================================================= -Name Type Description -================================ ============================================================================================================================================================================================================ ============================================================= -domainBoundaryIndicator integer_array (no description available) -edgeList InterObjectRelation< Array< Array< long, 1, int_seq< long, 0l >, long, ChaiVector< long > >, 1, int_seq< long, 0l >, long, ChaiVector< Array< long, 1, int_seq< long, 0l >, long, ChaiVector< long > > > > > Map to the edges attached to each FaceElement. -elementAperture real64_array The aperture of each FaceElement. -elementArea real64_array The area of each FaceElement. -elementCenter r1_array The center of each FaceElement. -elementVolume real64_array The volume of each FaceElement. -faceList InterObjectRelation< Array< long, 2, int_seq< long, 0l, 1l >, long, ChaiVector< long > > > Map to the faces attached to each FaceElement. -fractureElementsToCellIndices localIndex_array2d A map of face element local indices to the cell local indices -fractureElementsToCellRegions localIndex_array2d A map of face element local indices to the cell local indices -fractureElementsToCellSubRegions localIndex_array2d A map of face element local indices to the cell local indices -ghostRank integer_array (no description available) -globalToLocalMap mapBase< long long, long, integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -nodeList InterObjectRelation< Array< Array< long, 1, int_seq< long, 0l >, long, ChaiVector< long > >, 1, int_seq< long, 0l >, long, ChaiVector< Array< long, 1, int_seq< long, 0l >, long, ChaiVector< long > > > > > Map to the nodes attached to each FaceElement. -ConstitutiveModels node :ref:`DATASTRUCTURE_ConstitutiveModels` -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -================================ ============================================================================================================================================================================================================ ============================================================= +================================ ================================================================================================================================= ============================================================= +Name Type Description +================================ ================================================================================================================================= ============================================================= +domainBoundaryIndicator integer_array (no description available) +edgeList InterObjectRelation< Array< Array< long, 1, int_seq< long, 0l >, long, ChaiBuffer >, 1, int_seq< long, 0l >, long, ChaiBuffer > > Map to the edges attached to each FaceElement. +elementAperture real64_array The aperture of each FaceElement. +elementArea real64_array The area of each FaceElement. +elementCenter r1_array The center of each FaceElement. +elementVolume real64_array The volume of each FaceElement. +faceList InterObjectRelation< Array< long, 2, int_seq< long, 0l, 1l >, long, ChaiBuffer > > Map to the faces attached to each FaceElement. +fractureElementsToCellIndices localIndex_array2d A map of face element local indices to the cell local indices +fractureElementsToCellRegions localIndex_array2d A map of face element local indices to the cell local indices +fractureElementsToCellSubRegions localIndex_array2d A map of face element local indices to the cell local indices +ghostRank integer_array (no description available) +globalToLocalMap mapBase< long long, long, integral_constant< bool, false > > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +nodeList InterObjectRelation< Array< Array< long, 1, int_seq< long, 0l >, long, ChaiBuffer >, 1, int_seq< long, 0l >, long, ChaiBuffer > > Map to the nodes attached to each FaceElement. +ConstitutiveModels node :ref:`DATASTRUCTURE_ConstitutiveModels` +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +================================ ================================================================================================================================= ============================================================= diff --git a/src/coreComponents/fileIO/schema/docs/domain_other.rst b/src/coreComponents/fileIO/schema/docs/domain_other.rst index d35b3839cf3..51eb9ddb16c 100644 --- a/src/coreComponents/fileIO/schema/docs/domain_other.rst +++ b/src/coreComponents/fileIO/schema/docs/domain_other.rst @@ -1,13 +1,13 @@ -================ =============================================================================================== ================================= -Name Type Description -================ =============================================================================================== ================================= -Neighbors Array< NeighborCommunicator, 1, int_seq< long, 0l >, long, ChaiVector< NeighborCommunicator > > (no description available) -partitionManager PartitionBase (no description available) -Constitutive node :ref:`DATASTRUCTURE_Constitutive` -MeshBodies node :ref:`DATASTRUCTURE_MeshBodies` -cellManager node :ref:`DATASTRUCTURE_cellManager` -================ =============================================================================================== ================================= +================ ======================================================================= ================================= +Name Type Description +================ ======================================================================= ================================= +Neighbors Array< NeighborCommunicator, 1, int_seq< long, 0l >, long, ChaiBuffer > (no description available) +partitionManager PartitionBase (no description available) +Constitutive node :ref:`DATASTRUCTURE_Constitutive` +MeshBodies node :ref:`DATASTRUCTURE_MeshBodies` +cellManager node :ref:`DATASTRUCTURE_cellManager` +================ ======================================================================= ================================= diff --git a/src/coreComponents/fileIO/schema/docs/edgeManager_other.rst b/src/coreComponents/fileIO/schema/docs/edgeManager_other.rst index 96a1e2d13e9..68afd4460b4 100644 --- a/src/coreComponents/fileIO/schema/docs/edgeManager_other.rst +++ b/src/coreComponents/fileIO/schema/docs/edgeManager_other.rst @@ -1,25 +1,25 @@ -================================ ========================================================================================== ==================================================================== -Name Type Description -================================ ========================================================================================== ==================================================================== -SIF_I real64_array SIF_I of the edge. -SIF_II real64_array SIF_II of the edge. -SIF_III real64_array SIF_III of the edge. -childIndex localIndex_array Child index of the edge. -domainBoundaryIndicator integer_array (no description available) -edgesToFractureConnectors mapBase< long, long, integral_constant< bool, true > > A map of edge local indices to the fracture connector local indices. -faceList InterObjectRelation< ArrayOfSets< long, long > > (no description available) -fractureConnectorsToEdges localIndex_array A map of fracture connector local indices to edge local indices. -fractureConnectorsToElementIndex ArrayOfArrays< long, long > A map of fracture connector local indices face element local indices -ghostRank integer_array (no description available) -globalToLocalMap mapBase< long long, long, integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -nodeList InterObjectRelation< Array< long, 2, int_seq< long, 0l, 1l >, long, ChaiVector< long > > > (no description available) -parentIndex localIndex_array Parent index of the edge. -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -================================ ========================================================================================== ==================================================================== +================================ ================================================================================== ==================================================================== +Name Type Description +================================ ================================================================================== ==================================================================== +SIF_I real64_array SIF_I of the edge. +SIF_II real64_array SIF_II of the edge. +SIF_III real64_array SIF_III of the edge. +childIndex localIndex_array Child index of the edge. +domainBoundaryIndicator integer_array (no description available) +edgesToFractureConnectors mapBase< long, long, integral_constant< bool, true > > A map of edge local indices to the fracture connector local indices. +faceList InterObjectRelation< ArrayOfSets< long, long > > (no description available) +fractureConnectorsToEdges localIndex_array A map of fracture connector local indices to edge local indices. +fractureConnectorsToElementIndex ArrayOfArrays< long, long > A map of fracture connector local indices face element local indices +ghostRank integer_array (no description available) +globalToLocalMap mapBase< long long, long, integral_constant< bool, false > > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +nodeList InterObjectRelation< Array< long, 2, int_seq< long, 0l, 1l >, long, ChaiBuffer > > (no description available) +parentIndex localIndex_array Parent index of the edge. +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +================================ ================================================================================== ==================================================================== diff --git a/src/coreComponents/fileIO/schema/schema.xsd b/src/coreComponents/fileIO/schema/schema.xsd index 55e50b07abd..37cf1c7df42 100644 --- a/src/coreComponents/fileIO/schema/schema.xsd +++ b/src/coreComponents/fileIO/schema/schema.xsd @@ -671,21 +671,12 @@ - - - - - - - - - diff --git a/src/coreComponents/fileIO/schema/schema.xsd.other b/src/coreComponents/fileIO/schema/schema.xsd.other index 190c0d049fd..494cd418254 100644 --- a/src/coreComponents/fileIO/schema/schema.xsd.other +++ b/src/coreComponents/fileIO/schema/schema.xsd.other @@ -394,14 +394,12 @@ - - @@ -597,7 +595,7 @@ - + @@ -621,25 +619,25 @@ - + - + - + - + - + - + @@ -651,7 +649,7 @@ - + @@ -663,7 +661,7 @@ - + @@ -671,7 +669,7 @@ - + @@ -681,7 +679,7 @@ - + @@ -689,25 +687,25 @@ - + - + - + - + - + - + @@ -719,7 +717,7 @@ - + @@ -750,7 +748,7 @@ - + @@ -784,7 +782,7 @@ - + @@ -804,7 +802,7 @@ - + @@ -812,7 +810,7 @@ - + @@ -896,7 +894,7 @@ - + @@ -1079,7 +1077,7 @@ - + @@ -1089,7 +1087,7 @@ - + @@ -1105,7 +1103,7 @@ - + @@ -1155,7 +1153,7 @@ - + diff --git a/src/coreComponents/fileIO/utils/utils.hpp b/src/coreComponents/fileIO/utils/utils.hpp index c8e09d5ba04..8c346e0c331 100644 --- a/src/coreComponents/fileIO/utils/utils.hpp +++ b/src/coreComponents/fileIO/utils/utils.hpp @@ -26,65 +26,65 @@ namespace geosx { /* Taken from http://www.martinbroadhurst.com/list-the-files-in-a-directory-in-c.html */ -inline void readDirectory(const std::string& name, std::vector& v) +inline void readDirectory( std::string const & name, std::vector< std::string >& v) { - DIR* dirp = opendir(name.c_str()); + DIR * dirp = opendir( name.c_str() ); struct dirent * dp; - while((dp = readdir(dirp)) != nullptr ) + while( (dp = readdir( dirp )) != nullptr ) { - v.push_back(dp->d_name); + v.push_back( dp->d_name ); } - closedir(dirp); + closedir( dirp ); } -inline void getAbsolutePath(const std::string & path, std::string & absolute_path ) +inline void getAbsolutePath( std::string const & path, std::string & absolute_path ) { - char abs_file_path[PATH_MAX + 1]; - if( realpath(path.data(), abs_file_path)) + char abs_file_path[ PATH_MAX + 1 ]; + if( realpath( path.data(), abs_file_path ) ) { absolute_path = abs_file_path; } else { - char const * ret = getcwd(abs_file_path, PATH_MAX + 1); - if (ret != nullptr) - GEOS_ERROR("Could not get the absolute path for " << path << " from " << abs_file_path); + char const * ret = getcwd( abs_file_path, PATH_MAX + 1 ); + if ( ret != nullptr ) + GEOS_ERROR( "Could not get the absolute path for " << path << " from " << abs_file_path ); else - GEOS_ERROR("Could not get the absolute path for " << path); + GEOS_ERROR( "Could not get the absolute path for " << path ); } } -inline void splitPath(const std::string& path, std::string& dirname, std::string& basename) +inline void splitPath( std::string const & path, std::string & dirname, std::string & basename ) { - size_t pos = path.find_last_of('/'); + size_t pos = path.find_last_of( '/' ); if( pos == string::npos ) { - dirname = std::string("."); + dirname = "."; basename = path; } else if( pos == 0 ) { - dirname = std::string("/"); - basename = path.substr(1); + dirname = "/"; + basename = path.substr( 1 ); return; } else { - dirname = path.substr(0, pos); - basename = path.substr(pos + 1); + dirname = path.substr( 0, pos ); + basename = path.substr( pos + 1 ); } } -inline bool isAbsolutePath(const std::string & path) +inline bool isAbsolutePath( const std::string & path ) { - return path[0] == '/'; + return path[ 0 ] == '/'; } -template -inline bool regexMatch(const std::string & str, REGEX regex) +template< typename REGEX > +inline bool regexMatch( const std::string & str, REGEX regex ) { return std::regex_match(str, regex); } diff --git a/src/coreComponents/fileIO/vtk/VTKFile.cpp b/src/coreComponents/fileIO/vtk/VTKFile.cpp index 30de6ec0bc0..5a6d151b0a0 100644 --- a/src/coreComponents/fileIO/vtk/VTKFile.cpp +++ b/src/coreComponents/fileIO/vtk/VTKFile.cpp @@ -16,12 +16,14 @@ * @file VTKFile.cpp */ +// Source includes #include "VTKFile.hpp" -#include - #include "dataRepository/Wrapper.hpp" #include "managers/DomainPartition.hpp" +#include "mpiCommunications/MpiWrapper.hpp" +// System includes +#include namespace geosx diff --git a/src/coreComponents/managers/CMakeLists.txt b/src/coreComponents/managers/CMakeLists.txt index d5036d75ec8..ba0f60037c6 100644 --- a/src/coreComponents/managers/CMakeLists.txt +++ b/src/coreComponents/managers/CMakeLists.txt @@ -13,7 +13,6 @@ set(managers_headers Outputs/SiloOutput.hpp Outputs/VTKOutput.hpp Outputs/RestartOutput.hpp - Outputs/BlueprintOutput.hpp Functions/FunctionBase.hpp Functions/SymbolicFunction.hpp Functions/TableFunction.hpp @@ -46,7 +45,6 @@ set(managers_sources Outputs/SiloOutput.cpp Outputs/VTKOutput.cpp Outputs/RestartOutput.cpp - Outputs/BlueprintOutput.cpp Functions/FunctionBase.cpp Functions/SymbolicFunction.cpp Functions/TableFunction.cpp diff --git a/src/coreComponents/managers/ObjectManagerBase.cpp b/src/coreComponents/managers/ObjectManagerBase.cpp index a49cf0ad6ec..0d9a02d4c9d 100644 --- a/src/coreComponents/managers/ObjectManagerBase.cpp +++ b/src/coreComponents/managers/ObjectManagerBase.cpp @@ -18,6 +18,7 @@ #include "ObjectManagerBase.hpp" #include "common/TimingMacros.hpp" +#include "mpiCommunications/MpiWrapper.hpp" namespace geosx { @@ -751,9 +752,8 @@ localIndex ObjectManagerBase::GetNumberOfLocalIndices() const //return std::count_if( m_ghostRank.begin(), m_ghostRank.end(), [](integer i)->localIndex {return i==-1;} ); } -void ObjectManagerBase::SetReceiveLists( ) +void ObjectManagerBase::SetReceiveLists() { - map receiveIndices; for( localIndex a=0 ; agetReference( m_ObjectManagerBaseViewKeys.ghostsToReceive ); nodeAdjacencyList = iter->second; } - } integer ObjectManagerBase::SplitObject( localIndex const indexToSplit, diff --git a/src/coreComponents/managers/Outputs/BlueprintOutput.cpp b/src/coreComponents/managers/Outputs/BlueprintOutput.cpp deleted file mode 100644 index 173283708ce..00000000000 --- a/src/coreComponents/managers/Outputs/BlueprintOutput.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * ------------------------------------------------------------------------------------------------------------ - * SPDX-License-Identifier: LGPL-2.1-only - * - * Copyright (c) 2018-2019 Lawrence Livermore National Security LLC - * Copyright (c) 2018-2019 The Board of Trustees of the Leland Stanford Junior University - * Copyright (c) 2018-2019 Total, S.A - * Copyright (c) 2019- GEOSX Contributors - * All right reserved - * - * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. - * ------------------------------------------------------------------------------------------------------------ - */ - -/** - * @file BlueprintOutput.cpp - */ -#include "BlueprintOutput.hpp" -#include "mesh/MeshLevel.hpp" -#include "managers/DomainPartition.hpp" -#include "fileIO/blueprint/Blueprint.hpp" - - -namespace geosx -{ - -using namespace dataRepository; -using namespace cxx_utilities; - -BlueprintOutput::BlueprintOutput( std::string const & name, - Group * const parent ): - OutputBase( name, parent) -{ -} - -BlueprintOutput::~BlueprintOutput() -{} - - -void BlueprintOutput::Execute(real64 const GEOSX_UNUSED_ARG( time_n ), - real64 const GEOSX_UNUSED_ARG( dt ), - integer const cycleNumber, - integer const eventCounter, - real64 const GEOSX_UNUSED_ARG( eventProgress ), - Group * domain) -{ - DomainPartition* domainPartition = Group::group_cast(domain); - - const MeshLevel * meshLevel = domainPartition->getMeshBody(0)->getMeshLevel(0); - Blueprint bpWriter(*meshLevel->getNodeManager(), - *meshLevel->getElemManager(), - "bp_plot", MPI_COMM_GEOSX); - - bpWriter.write(cycleNumber, eventCounter ); -} - - -REGISTER_CATALOG_ENTRY( OutputBase, BlueprintOutput, std::string const &, Group * const ) -} /* namespace geosx */ diff --git a/src/coreComponents/managers/Outputs/BlueprintOutput.hpp b/src/coreComponents/managers/Outputs/BlueprintOutput.hpp deleted file mode 100644 index d2a0fe1863a..00000000000 --- a/src/coreComponents/managers/Outputs/BlueprintOutput.hpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * ------------------------------------------------------------------------------------------------------------ - * SPDX-License-Identifier: LGPL-2.1-only - * - * Copyright (c) 2018-2019 Lawrence Livermore National Security LLC - * Copyright (c) 2018-2019 The Board of Trustees of the Leland Stanford Junior University - * Copyright (c) 2018-2019 Total, S.A - * Copyright (c) 2019- GEOSX Contributors - * All right reserved - * - * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. - * ------------------------------------------------------------------------------------------------------------ - */ - -/** - * @file BlueprintOutput.hpp - */ - -#ifndef GEOSX_MANAGERS_OUTPUTS_BLUEPRINTOUTPUT_HPP_ -#define GEOSX_MANAGERS_OUTPUTS_BLUEPRINTOUTPUT_HPP_ - -#include "OutputBase.hpp" -#include "fileIO/blueprint/Blueprint.hpp" - -namespace geosx -{ - -/** - * @class BlueprintOutput - * - * A class for creating blueprint-based outputs - */ -class BlueprintOutput : public OutputBase -{ -public: - /// Main constructor - BlueprintOutput( std::string const & name, - Group * const parent ); - - /// Destructor - virtual ~BlueprintOutput() override; - - /// Catalog name interface - static string CatalogName() { return "Blueprint"; } - - /// This method will be called by the event manager if triggered - virtual void Execute( real64 const time_n, - real64 const dt, - integer const cycleNumber, - integer const eventCounter, - real64 const eventProgress, - dataRepository::Group * domain ) override; - - /// Write one final output as the code exits - virtual void Cleanup( real64 const time_n, - integer const cycleNumber, - integer const eventCounter, - real64 const eventProgress, - dataRepository::Group * domain ) override - { - Execute(time_n, 0, cycleNumber, eventCounter, eventProgress, domain); - } - - - struct viewKeyStruct - { - dataRepository::ViewKey writeFEMFaces = { "writeFEMFaces" }; - } viewKeys; - -}; - - -} /* namespace geosx */ - -#endif /* GEOSX_MANAGERS_OUTPUTS_BLUEPRINTOUTPUT_HPP_ */ diff --git a/src/coreComponents/managers/Outputs/RestartOutput.cpp b/src/coreComponents/managers/Outputs/RestartOutput.cpp index 235f8d6b0f3..eb8c0268d4a 100644 --- a/src/coreComponents/managers/Outputs/RestartOutput.cpp +++ b/src/coreComponents/managers/Outputs/RestartOutput.cpp @@ -60,8 +60,9 @@ void RestartOutput::Execute(real64 const GEOSX_UNUSED_ARG( time_n ), problemManager->prepareToWrite(); FunctionManager::Instance()->prepareToWrite(); FieldSpecificationManager::get()->prepareToWrite(); - int const numFiles = MpiWrapper::Comm_size( MPI_COMM_GEOSX ); - SidreWrapper::writeTree( numFiles, fileName, "sidre_hdf5", MPI_COMM_GEOSX ); + int numFiles; + MPI_Comm_size( MPI_COMM_GEOSX, &numFiles ); + writeTree( fileName ); problemManager->finishWriting(); FunctionManager::Instance()->finishWriting(); FieldSpecificationManager::get()->finishWriting(); diff --git a/src/coreComponents/managers/ProblemManager.cpp b/src/coreComponents/managers/ProblemManager.cpp index 0868a9ca2f0..17c4eb0d9d6 100644 --- a/src/coreComponents/managers/ProblemManager.cpp +++ b/src/coreComponents/managers/ProblemManager.cpp @@ -912,14 +912,10 @@ void ProblemManager::ApplyInitialConditions() } -void ProblemManager::ReadRestartOverwrite( const std::string& restartFileName ) +void ProblemManager::ReadRestartOverwrite() { -#ifdef GEOSX_USE_ATK - this->prepareToRead(); - SidreWrapper::loadExternalData(restartFileName, MPI_COMM_GEOSX); - this->finishReading(); - this->postRestartInitializationRecursive( GetGroup(keys::domain) ); -#endif + this->loadFromConduit(); + this->postRestartInitializationRecursive( GetGroup< DomainPartition >( keys::domain ) ); } diff --git a/src/coreComponents/managers/ProblemManager.hpp b/src/coreComponents/managers/ProblemManager.hpp index 38e3596684b..89e0e6e40af 100644 --- a/src/coreComponents/managers/ProblemManager.hpp +++ b/src/coreComponents/managers/ProblemManager.hpp @@ -97,7 +97,7 @@ class ProblemManager : public ObjectManagerBase void RunSimulation(); - void ReadRestartOverwrite( const std::string& restartFileName ); + void ReadRestartOverwrite(); void ApplyInitialConditions(); diff --git a/src/coreComponents/managers/unitTests/testRecursiveFieldApplication.cpp b/src/coreComponents/managers/unitTests/testRecursiveFieldApplication.cpp index 16b8fcb5aef..ea9bdf78985 100644 --- a/src/coreComponents/managers/unitTests/testRecursiveFieldApplication.cpp +++ b/src/coreComponents/managers/unitTests/testRecursiveFieldApplication.cpp @@ -115,29 +115,40 @@ TEST(FieldSpecification, Recursive) reg1->GetSubRegion("reg1tet")->registerWrapper< array1d >( "field3" ); - auto set0hex = reg0->GetSubRegion("reg0hex")->GetGroup("sets")->registerWrapper( std::string("all") ); - set0hex->resize(nbHexReg0); - for(localIndex i = 0; i < set0hex->size() ; i++) + localIndex_set & set0hex = reg0->GetSubRegion("reg0hex") + ->GetGroup("sets") + ->registerWrapper( std::string("all") ) + ->reference(); + for(localIndex i = 0; i < nbHexReg0 ; i++) { - set0hex->dataPtr()[i]=i; + set0hex.insert( i ); } - auto set0tet = reg0->GetSubRegion("reg0tet")->GetGroup("sets")->registerWrapper( std::string("all") ); - set0tet->resize(nbTetReg0); - for(localIndex i = 0; i < set0tet->size() ; i++) + + localIndex_set & set0tet = reg0->GetSubRegion("reg0tet") + ->GetGroup("sets") + ->registerWrapper( std::string("all") ) + ->reference(); + for(localIndex i = 0; i < nbTetReg0 ; i++) { - set0tet->dataPtr()[i] = i; + set0tet.insert( i ); } - auto set1hex = reg1->GetSubRegion("reg1hex")->GetGroup("sets")->registerWrapper( std::string("all") ); - set1hex->resize(nbHexReg1); - for(localIndex i = 0; i < set1hex->size() ; i++) + + localIndex_set & set1hex = reg1->GetSubRegion("reg1hex") + ->GetGroup("sets") + ->registerWrapper( std::string("all") ) + ->reference(); + for(localIndex i = 0; i < nbHexReg1 ; i++) { - set1hex->dataPtr()[i] = i; + set1hex.insert( i ); } - auto set1tet = reg1->GetSubRegion("reg1tet")->GetGroup("sets")->registerWrapper( std::string("all") ); - set1tet->resize(nbTetReg1); - for(localIndex i = 0; i < set1tet->size() ; i++) + + localIndex_set & set1tet = reg1->GetSubRegion("reg1tet") + ->GetGroup("sets") + ->registerWrapper( std::string("all") ) + ->reference(); + for(localIndex i = 0; i < nbTetReg1 ; i++) { - set1tet->dataPtr()[i] = i; + set1tet.insert( i ); } RegisterAndApplyField(domain.get(), "field0", "ElementRegions", 1.); diff --git a/src/coreComponents/mesh/BufferOps.cpp b/src/coreComponents/mesh/BufferOps.cpp index 323b89fabcf..88046b4a151 100644 --- a/src/coreComponents/mesh/BufferOps.cpp +++ b/src/coreComponents/mesh/BufferOps.cpp @@ -26,7 +26,7 @@ namespace bufferOps template< bool DO_PACKING > -localIndex Pack( char*& buffer, +localIndex Pack( buffer_unit_type *& buffer, OrderedVariableToManyElementRelation const & var, arrayView1d const & packList, ElementRegionManager const * const elementRegionManager ) @@ -62,17 +62,17 @@ localIndex Pack( char*& buffer, return sizeOfPackedChars; } -template localIndex Pack( char*&, +template localIndex Pack( buffer_unit_type *&, OrderedVariableToManyElementRelation const &, arrayView1d const &, ElementRegionManager const * const ); -template localIndex Pack( char*&, +template localIndex Pack( buffer_unit_type *&, OrderedVariableToManyElementRelation const &, arrayView1d const &, ElementRegionManager const * const ); -localIndex Unpack( char const * & buffer, +localIndex Unpack( buffer_unit_type const * & buffer, OrderedVariableToManyElementRelation & var, arrayView1d const & packList, ElementRegionManager const * const elementRegionManager, @@ -156,7 +156,7 @@ localIndex Unpack( char const * & buffer, template< bool DO_PACKING > -localIndex Pack( char*& buffer, +localIndex Pack( buffer_unit_type *& buffer, FixedToManyElementRelation const & var, arrayView1d const & packList, ElementRegionManager const * const elementRegionManager ) @@ -192,17 +192,17 @@ localIndex Pack( char*& buffer, return sizeOfPackedChars; } -template localIndex Pack( char*&, +template localIndex Pack( buffer_unit_type *&, FixedToManyElementRelation const &, arrayView1d const &, ElementRegionManager const * const ); -template localIndex Pack( char*&, +template localIndex Pack( buffer_unit_type *&, FixedToManyElementRelation const &, arrayView1d const &, ElementRegionManager const * const ); -localIndex Unpack( char const * & buffer, +localIndex Unpack( buffer_unit_type const * & buffer, FixedToManyElementRelation & var, arrayView1d const & packList, ElementRegionManager const * const elementRegionManager, diff --git a/src/coreComponents/mesh/BufferOps.hpp b/src/coreComponents/mesh/BufferOps.hpp index c35ae20bc01..a1c4750aae3 100644 --- a/src/coreComponents/mesh/BufferOps.hpp +++ b/src/coreComponents/mesh/BufferOps.hpp @@ -28,26 +28,26 @@ namespace bufferOps { template< bool DO_PACKING > -localIndex Pack( char*& buffer, +localIndex Pack( buffer_unit_type *& buffer, OrderedVariableToManyElementRelation const & var, arrayView1d const & packList, ElementRegionManager const * const elementRegionManager ); template< bool DO_PACKING > -localIndex Pack( char*& buffer, +localIndex Pack( buffer_unit_type *& buffer, FixedToManyElementRelation const & var, arrayView1d const & packList, ElementRegionManager const * const elementRegionManager ); -localIndex Unpack( char const * & buffer, +localIndex Unpack( buffer_unit_type const * & buffer, OrderedVariableToManyElementRelation & var, arrayView1d const & packList, ElementRegionManager const * const elementRegionManager, bool const clearFlag ); -localIndex Unpack( char const * & buffer, +localIndex Unpack( buffer_unit_type const * & buffer, FixedToManyElementRelation & var, arrayView1d const & packList, ElementRegionManager const * const elementRegionManager, diff --git a/src/coreComponents/meshUtilities/VTMMeshGenerator.cpp b/src/coreComponents/meshUtilities/VTMMeshGenerator.cpp index 28a5750d838..d43b1da2ecc 100644 --- a/src/coreComponents/meshUtilities/VTMMeshGenerator.cpp +++ b/src/coreComponents/meshUtilities/VTMMeshGenerator.cpp @@ -129,7 +129,7 @@ void VTMMeshGenerator::GenerateMesh( DomainPartition * const domain ) cellBlock -> SetElementType("C3D8"); auto & cellToVertex = cellBlock->nodeList(); cellBlock->resize( mesh.NumCells()); - cellToVertex.resize( mesh.NumCells(), mesh.NumVerticesInCell(0)); + cellToVertex.resize( mesh.NumCells(), mesh.NumVerticesInCell(0) ); for( localIndex k=0 ; k SetElementType("C3D4"); auto & cellToVertex = cellBlock->nodeList(); cellBlock->resize( mesh.NumCells()); - cellToVertex.resize( mesh.NumCells(), mesh.NumVerticesInCell(0)); + cellToVertex.resize( mesh.NumCells(), mesh.NumVerticesInCell(0) ); for( localIndex k=0 ; k, globalIndex> > > > - neighborCompositionObjects( neighbors.size() ); + std::vector, globalIndex> > > > + neighborCompositionObjects( neighbors.size() ); for( int count=0 ; count inline MPI_Datatype MpiWrapper::getMpiType< char >() { return MPI_CHAR; } +template<> inline MPI_Datatype MpiWrapper::getMpiType< signed char >() { return MPI_SIGNED_CHAR; } template<> inline MPI_Datatype MpiWrapper::getMpiType< float >() { return MPI_FLOAT; } template<> inline MPI_Datatype MpiWrapper::getMpiType< double >() { return MPI_DOUBLE; } template<> inline MPI_Datatype MpiWrapper::getMpiType< int >() { return MPI_INT; } @@ -523,6 +529,20 @@ void MpiWrapper::Broadcast( T & MPI_PARAM( value ), int MPI_PARAM( srcRank ) ) #endif } +template<> +inline +void MpiWrapper::Broadcast( std::string & MPI_PARAM( value ), int MPI_PARAM( srcRank ) ) +{ +#ifdef GEOSX_USE_MPI + int size = value.size(); + Broadcast( size, srcRank ); + + value.resize( size ); + + MPI_Bcast( const_cast< char * >( value.data() ), size, getMpiType< char >(), srcRank, MPI_COMM_GEOSX ); +#endif +} + template< typename TS, typename TR > int MpiWrapper::gather( TS const * const sendbuf, int sendcount, diff --git a/src/coreComponents/mpiCommunications/NeighborCommunicator.cpp b/src/coreComponents/mpiCommunications/NeighborCommunicator.cpp index 08a54f8be57..72ac284f805 100644 --- a/src/coreComponents/mpiCommunications/NeighborCommunicator.cpp +++ b/src/coreComponents/mpiCommunications/NeighborCommunicator.cpp @@ -45,10 +45,10 @@ NeighborCommunicator::NeighborCommunicator(): //{ //} -void NeighborCommunicator::MPI_iSendReceive( char const * const sendBuffer, +void NeighborCommunicator::MPI_iSendReceive( buffer_unit_type const * const sendBuffer, int const sendSize, MPI_Request& sendRequest, - char * const receiveBuffer, + buffer_unit_type * const receiveBuffer, int const receiveSize, MPI_Request& receiveRequest, int const commID, @@ -56,7 +56,7 @@ void NeighborCommunicator::MPI_iSendReceive( char const * const sendBuffer, { int const sendTag = CommTag( Rank(), m_neighborRank, commID ); //m_rank * m_size + m_neighborRank + m_size*m_size*commID; - MpiWrapper::iSend( const_cast(sendBuffer), + MpiWrapper::iSend( const_cast(sendBuffer), sendSize, m_neighborRank, sendTag, @@ -153,7 +153,7 @@ void NeighborCommunicator::MPI_iSendReceive( int const commID, mpiComm ); } -void NeighborCommunicator::MPI_iSendReceive( char const * const sendBuffer, +void NeighborCommunicator::MPI_iSendReceive( buffer_unit_type const * const sendBuffer, int const sendSize, int const commID, MPI_Comm mpiComm ) diff --git a/src/coreComponents/mpiCommunications/NeighborCommunicator.hpp b/src/coreComponents/mpiCommunications/NeighborCommunicator.hpp index 78d8c1fe94f..ef32bb9de00 100644 --- a/src/coreComponents/mpiCommunications/NeighborCommunicator.hpp +++ b/src/coreComponents/mpiCommunications/NeighborCommunicator.hpp @@ -45,10 +45,10 @@ class NeighborCommunicator // ~NeighborCommunicator(); - void MPI_iSendReceive( char const * const sendBuffer, + void MPI_iSendReceive( buffer_unit_type const * const sendBuffer, int const sendSize, MPI_Request& sendRequest, - char * const receiveBuffer, + buffer_unit_type * const receiveBuffer, int const receiveSize, MPI_Request& receiveRequest, int const commID, @@ -89,10 +89,10 @@ class NeighborCommunicator int const commID, MPI_Comm mpiComm ) { - MPI_iSendReceive( reinterpret_cast( sendBuffer ), + MPI_iSendReceive( reinterpret_cast( sendBuffer ), sendSize * sizeof(T), sendReq, - reinterpret_cast( recvBuffer ), + reinterpret_cast( recvBuffer ), recvSize * sizeof(T), recvReq, commID, @@ -134,7 +134,7 @@ class NeighborCommunicator } - void MPI_iSendReceive( char const * const sendBuffer, + void MPI_iSendReceive( buffer_unit_type const * const sendBuffer, int const sendSize, int const commID, MPI_Comm mpiComm ); diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp index c69b0d4d080..5b78a579570 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp @@ -489,8 +489,8 @@ int SurfaceGenerator::SeparationDriver( DomainPartition * domain, FaceManager & faceManager = *(mesh->getFaceManager()); ElementRegionManager & elementManager = *(mesh->getElemManager()); - std::vector > nodesToRupturedFaces; - std::vector > edgesToRupturedFaces; + std::vector< std::set< localIndex > > nodesToRupturedFaces; + std::vector< std::set< localIndex > > edgesToRupturedFaces; ArrayOfArraysView const & nodeToElementMap = nodeManager.elementList(); ArrayOfArraysView const & faceToNodeMap = faceManager.nodeList(); @@ -2419,7 +2419,7 @@ void SurfaceGenerator::MapConsistencyCheck( localIndex const GEOSX_UNUSED_ARG( n } // faceToElement - std::vector > > inverseElemsToFaces( faceManager.size() ); + std::vector< std::set< std::pair< CellElementSubRegion const *, localIndex > > > inverseElemsToFaces( faceManager.size() ); for( localIndex er=0 ; er >& nodesToRupturedFaces, - std::vector >& edgesToRupturedFaces ) + std::vector< std::set< localIndex > > & nodesToRupturedFaces, + std::vector< std::set< localIndex > > & edgesToRupturedFaces ) { ArrayOfArraysView< localIndex const > const & faceToNodeMap = faceManager.nodeList(); ArrayOfArraysView< localIndex const > const & faceToEdgeMap = faceManager.edgeList(); diff --git a/src/coreComponents/physicsSolvers/unitTests/testCompFlowUtils.hpp b/src/coreComponents/physicsSolvers/unitTests/testCompFlowUtils.hpp index dd906645153..e8743b157bb 100644 --- a/src/coreComponents/physicsSolvers/unitTests/testCompFlowUtils.hpp +++ b/src/coreComponents/physicsSolvers/unitTests/testCompFlowUtils.hpp @@ -67,9 +67,9 @@ void checkDerivative( arraySlice1d< real64 const > const & valueEps, } template -void checkDerivative( array_slice< real64 const, DIM > const & valueEps, - array_slice< real64 const, DIM > const & value, - array_slice< real64 const, DIM > const & deriv, +void checkDerivative( ArraySlice< real64 const, DIM > const & valueEps, + ArraySlice< real64 const, DIM > const & value, + ArraySlice< real64 const, DIM > const & deriv, real64 const eps, real64 const relTol, real64 const absTol, @@ -88,9 +88,9 @@ void checkDerivative( array_slice< real64 const, DIM > const & valueEps, } template< int DIM, typename ... Args > -void checkDerivative( array_slice< real64 const, DIM > const & valueEps, - array_slice< real64 const, DIM > const & value, - array_slice< real64 const, DIM > const & deriv, +void checkDerivative( ArraySlice< real64 const, DIM > const & valueEps, + ArraySlice< real64 const, DIM > const & value, + ArraySlice< real64 const, DIM > const & deriv, real64 const eps, real64 const relTol, string const & name, diff --git a/src/coreComponents/physicsSolvers/unitTests/testCompMultiphaseFlow.cpp b/src/coreComponents/physicsSolvers/unitTests/testCompMultiphaseFlow.cpp index c24204ee438..e2715391200 100644 --- a/src/coreComponents/physicsSolvers/unitTests/testCompMultiphaseFlow.cpp +++ b/src/coreComponents/physicsSolvers/unitTests/testCompMultiphaseFlow.cpp @@ -37,9 +37,9 @@ char** global_argv; template struct TestCompositionalVarContainer { - array_slice value; // variable value - array_slice dPres; // derivative w.r.t. pressure - array_slice dComp; // derivative w.r.t. composition + ArraySlice value; // variable value + ArraySlice dPres; // derivative w.r.t. pressure + ArraySlice dComp; // derivative w.r.t. composition }; template diff --git a/src/coreComponents/physicsSolvers/unitTests/testCompMultiphaseFlowCapPressure.cpp b/src/coreComponents/physicsSolvers/unitTests/testCompMultiphaseFlowCapPressure.cpp index ad9f41d3ea4..a1cfb983597 100644 --- a/src/coreComponents/physicsSolvers/unitTests/testCompMultiphaseFlowCapPressure.cpp +++ b/src/coreComponents/physicsSolvers/unitTests/testCompMultiphaseFlowCapPressure.cpp @@ -36,9 +36,9 @@ char** global_argv; template struct TestCompositionalVarContainer { - array_slice value; // variable value - array_slice dPres; // derivative w.r.t. pressure - array_slice dComp; // derivative w.r.t. composition + ArraySlice value; // variable value + ArraySlice dPres; // derivative w.r.t. pressure + ArraySlice dComp; // derivative w.r.t. composition }; template diff --git a/src/coreComponents/physicsSolvers/unitTests/testFlowKernelHelpers.hpp b/src/coreComponents/physicsSolvers/unitTests/testFlowKernelHelpers.hpp index b58df762b70..6ed2a67cdbe 100644 --- a/src/coreComponents/physicsSolvers/unitTests/testFlowKernelHelpers.hpp +++ b/src/coreComponents/physicsSolvers/unitTests/testFlowKernelHelpers.hpp @@ -23,7 +23,7 @@ namespace detail { template -void setArrayElement( array_view const & arr, +void setArrayElement( ArrayView const & arr, localIndex const dstIndex, localIndex const srcIndex, T const * const data ) @@ -53,10 +53,10 @@ template<> struct AccessorHelper { template - using ElementAccessor = array_decl; + using ElementAccessor = Array; template - using MaterialAccessor = array_decl; + using MaterialAccessor = Array; template static ElementAccessor @@ -114,10 +114,10 @@ template<> struct AccessorHelper { template - using ElementAccessor = ElementRegionManager::ElementViewAccessor>; + using ElementAccessor = ElementRegionManager::ElementViewAccessor>; template - using MaterialAccessor = ElementRegionManager::MaterialViewAccessor>; + using MaterialAccessor = ElementRegionManager::MaterialViewAccessor>; template static ElementAccessor diff --git a/src/coreComponents/physicsSolvers/unitTests/testReservoirCompositionalMultiphaseMSWells.cpp b/src/coreComponents/physicsSolvers/unitTests/testReservoirCompositionalMultiphaseMSWells.cpp index fd153c9c9a5..fdd97ed9b84 100644 --- a/src/coreComponents/physicsSolvers/unitTests/testReservoirCompositionalMultiphaseMSWells.cpp +++ b/src/coreComponents/physicsSolvers/unitTests/testReservoirCompositionalMultiphaseMSWells.cpp @@ -41,9 +41,9 @@ char** global_argv; template struct TestReservoirVarContainer { - array_slice value; // variable value - array_slice dPres; // derivative w.r.t. pressure - array_slice dRate; // derivative w.r.t. rate + ArraySlice value; // variable value + ArraySlice dPres; // derivative w.r.t. pressure + ArraySlice dRate; // derivative w.r.t. rate }; diff --git a/src/coreComponents/physicsSolvers/unitTests/testReservoirSinglePhaseMSWells.cpp b/src/coreComponents/physicsSolvers/unitTests/testReservoirSinglePhaseMSWells.cpp index e30e9d31995..f17a2f12623 100644 --- a/src/coreComponents/physicsSolvers/unitTests/testReservoirSinglePhaseMSWells.cpp +++ b/src/coreComponents/physicsSolvers/unitTests/testReservoirSinglePhaseMSWells.cpp @@ -40,9 +40,9 @@ char** global_argv; template struct TestReservoirVarContainer { - array_slice value; // variable value - array_slice dPres; // derivative w.r.t. pressure - array_slice dRate; // derivative w.r.t. rate + ArraySlice value; // variable value + ArraySlice dPres; // derivative w.r.t. pressure + ArraySlice dRate; // derivative w.r.t. rate }; template diff --git a/src/coreComponents/wells/WellElementSubRegion.hpp b/src/coreComponents/wells/WellElementSubRegion.hpp index 1ae5d4dc04f..26ada96f3f2 100644 --- a/src/coreComponents/wells/WellElementSubRegion.hpp +++ b/src/coreComponents/wells/WellElementSubRegion.hpp @@ -40,8 +40,8 @@ class WellElementSubRegion : public ElementSubRegionBase static constexpr int NODE_MAP_UNIT_STRIDE_DIM = LvArray::getStrideOneDimension( NODE_MAP_PERMUTATION {} ); using NodeMapType = InterObjectRelation< array2d< localIndex, NODE_MAP_PERMUTATION > >; - using EdgeMapType=FixedOneToManyRelation; // unused but needed in MeshLevel::GenerateAdjacencyLists - using FaceMapType=FixedOneToManyRelation; // unused but needed in MeshLevel::GenerateAdjacencyLists + using EdgeMapType = FixedOneToManyRelation; // unused but needed in MeshLevel::GenerateAdjacencyLists + using FaceMapType = FixedOneToManyRelation; // unused but needed in MeshLevel::GenerateAdjacencyLists /** * @brief enumeration for values in segmentStatusList parameter of Generate() diff --git a/src/docs/sphinx/CompleteXMLSchema.rst b/src/docs/sphinx/CompleteXMLSchema.rst index 22f4b9e6f88..d4035cc09a8 100644 --- a/src/docs/sphinx/CompleteXMLSchema.rst +++ b/src/docs/sphinx/CompleteXMLSchema.rst @@ -21,13 +21,6 @@ Element: BlackOilFluid .. include:: ../../coreComponents/fileIO/schema/docs/BlackOilFluid.rst -.. _XML_Blueprint: - -Element: Blueprint -================== -.. include:: ../../coreComponents/fileIO/schema/docs/Blueprint.rst - - .. _XML_Box: Element: Box @@ -571,13 +564,6 @@ Datastructure: BlackOilFluid .. include:: ../../coreComponents/fileIO/schema/docs/BlackOilFluid_other.rst -.. _DATASTRUCTURE_Blueprint: - -Datastructure: Blueprint -======================== -.. include:: ../../coreComponents/fileIO/schema/docs/Blueprint_other.rst - - .. _DATASTRUCTURE_Box: Datastructure: Box diff --git a/src/main/main.cpp b/src/main/main.cpp index c0f6cd2b18c..c9bff5978e3 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -16,13 +16,17 @@ *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +// Source includes #include "managers/initialization.hpp" +#include "managers/ProblemManager.hpp" #include "common/DataTypes.hpp" #include "common/TimingMacros.hpp" +#include "mpiCommunications/MpiWrapper.hpp" + +// System includes #include #include #include -#include "managers/ProblemManager.hpp" using namespace geosx; @@ -42,7 +46,7 @@ int main( int argc, char *argv[] ) bool restart = ProblemManager::ParseRestart( argc, argv, restartFileName ); if (restart) { GEOS_LOG_RANK_0("Loading restart file " << restartFileName); - dataRepository::SidreWrapper::reconstructTree( restartFileName, "sidre_hdf5", MPI_COMM_GEOSX ); + dataRepository::loadTree( restartFileName ); } ProblemManager problemManager( "Problem", nullptr ); @@ -61,7 +65,7 @@ int main( int argc, char *argv[] ) problemManager.ProblemSetup(); if (restart) { - problemManager.ReadRestartOverwrite( restartFileName ); + problemManager.ReadRestartOverwrite(); } MpiWrapper::Barrier(MPI_COMM_GEOSX); From 68bd6b54e6d59734cc7039dffae0f19fe923d781 Mon Sep 17 00:00:00 2001 From: Benjamin Curtice Corbett Date: Fri, 1 Nov 2019 12:57:44 -0700 Subject: [PATCH 3/5] Replace ChaiVector with ChaiBuffer in LvArray::Array. --- .../codingUtilities/GeosxTraits.hpp | 2 +- src/coreComponents/common/DataTypes.hpp | 18 ++++++++++++------ src/coreComponents/cxx-utilities | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/coreComponents/codingUtilities/GeosxTraits.hpp b/src/coreComponents/codingUtilities/GeosxTraits.hpp index 401250bddac..b687bfaea42 100644 --- a/src/coreComponents/codingUtilities/GeosxTraits.hpp +++ b/src/coreComponents/codingUtilities/GeosxTraits.hpp @@ -189,7 +189,7 @@ template< typename T > constexpr bool is_set = is_instantiation_of_v< LvArray::SortedArray, T >; template< typename T > -constexpr bool is_array = LvArray::detail::is_array< T >::value; +constexpr bool is_array = LvArray::isArray< T >; template< typename T > constexpr bool is_tensorT = is_instance_of_v< R1Tensor, T > || diff --git a/src/coreComponents/common/DataTypes.hpp b/src/coreComponents/common/DataTypes.hpp index e190462d2da..69db626507f 100644 --- a/src/coreComponents/common/DataTypes.hpp +++ b/src/coreComponents/common/DataTypes.hpp @@ -26,7 +26,7 @@ #include "Macros.hpp" #include "Logger.hpp" #include "Array.hpp" -#include "StackArrayWrapper.hpp" +#include "StackBuffer.hpp" #include "SortedArray.hpp" #include "ArrayOfArrays.hpp" #include "ArrayOfSets.hpp" @@ -132,17 +132,23 @@ using buffer_type = std::vector< buffer_unit_type >; //***** BEGIN ARRAY TYPEDEFS ***** -template< typename T, int NDIM, typename PERMUTATION=camp::make_idx_seq_t< NDIM > > -using Array = LvArray::Array< T, NDIM, PERMUTATION, localIndex >; +template< typename T, + int NDIM, + typename PERMUTATION=camp::make_idx_seq_t< NDIM >, + template< typename ... > class DATA_VECTOR_TYPE=LvArray::ChaiBuffer > +using Array = LvArray::Array< T, NDIM, PERMUTATION, localIndex, DATA_VECTOR_TYPE >; -template< typename T, int NDIM, int UNIT_STRIDE_DIM = NDIM - 1 > -using ArrayView = LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, localIndex >; +template< typename T, + int NDIM, + int UNIT_STRIDE_DIM = NDIM - 1, + template< typename ... > class DATA_VECTOR_TYPE=LvArray::ChaiBuffer > +using ArrayView = LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, localIndex, DATA_VECTOR_TYPE >; template< typename T, int NDIM, int UNIT_STRIDE_DIM = NDIM - 1 > using ArraySlice = LvArray::ArraySlice< T, NDIM, UNIT_STRIDE_DIM, localIndex >; template< typename T, int NDIM, int MAXSIZE, typename PERMUTATION=camp::make_idx_seq_t< NDIM > > -using StackArray = LvArray::Array< T, NDIM, PERMUTATION, localIndex, LvArray::StackArrayWrapper< T, MAXSIZE > >; +using StackArray = LvArray::StackArray< T, NDIM, PERMUTATION, localIndex, MAXSIZE >; template< typename T > using array1d = Array< T, 1 >; diff --git a/src/coreComponents/cxx-utilities b/src/coreComponents/cxx-utilities index e749a8604d1..42b26f56c79 160000 --- a/src/coreComponents/cxx-utilities +++ b/src/coreComponents/cxx-utilities @@ -1 +1 @@ -Subproject commit e749a8604d160ec16401752c8a86835c71bac5cb +Subproject commit 42b26f56c790a29a3f84b3b613a25747cc94b135 From 0477f46dbf974150f95aca9785a1c303ea713ea6 Mon Sep 17 00:00:00 2001 From: Benjamin Curtice Corbett Date: Mon, 4 Nov 2019 15:45:53 -0800 Subject: [PATCH 4/5] Addressing PR comments and removing unused methods from Wrapper. --- .../included/included_b.xml | 6 +- .../parameters_example.xml | 6 +- .../symbolic_math_example.xml | 6 +- examples/event_examples.xml | 4 +- integratedTests | 2 +- .../codingUtilities/tests/testGeosxTraits.cpp | 3 + src/coreComponents/common/DataTypes.hpp | 4 +- src/coreComponents/cxx-utilities | 2 +- .../dataRepository/CMakeLists.txt | 4 +- .../{SidreWrapper.cpp => ConduitRestart.cpp} | 4 +- .../{SidreWrapper.hpp => ConduitRestart.hpp} | 8 +- src/coreComponents/dataRepository/Group.cpp | 2 +- src/coreComponents/dataRepository/Wrapper.hpp | 173 +----------------- .../dataRepository/WrapperBase.hpp | 63 +------ .../dataRepository/WrapperHelpers.hpp | 8 +- .../dataRepository/unitTests/CMakeLists.txt | 4 +- ...estSidreBasic.cpp => testRestartBasic.cpp} | 4 +- ...reExtended.cpp => testRestartExtended.cpp} | 56 +++--- .../managers/DomainPartition.cpp | 2 +- .../managers/Outputs/RestartOutput.cpp | 4 - .../managers/ProblemManager.cpp | 5 +- .../managers/docs/EventManager.rst | 2 +- .../Hydrofracture_KGD_EdgeBased_C3D6.xml | 4 +- .../Hydrofracture_KGD_NodeBased_C3D6.xml | 4 +- .../Hydrofracture_SinglePhase_2d.xml | 4 +- .../integratedTests/KGDTest_GEOSX.xml | 4 +- .../integratedTests/poroElastic_Mandel.xml | 4 +- .../integratedTests/poroElastic_Terzaghi.xml | 4 +- .../4comp_2ph_1d.xml | 4 +- .../4comp_2ph_cap_1d.xml | 4 +- .../blackoil_2ph_1d.xml | 4 +- .../deadoil_3ph_baker_1d.xml | 4 +- .../deadoil_3ph_corey_1d.xml | 4 +- .../deadoil_3ph_staircase_3d.xml | 4 +- .../singlePhaseFlow/compressible_1d.xml | 4 +- .../singlePhaseFlow/fractureFlow_2d.xml | 4 +- .../fractureJunctionFlow_2d.xml | 4 +- .../singlePhaseFlow/fractureMatrixFlow_2d.xml | 4 +- .../singlePhaseFlow/incompressible_1d.xml | 4 +- ...x10x10_compressible_pamela_hex_gravity.xml | 4 +- ...10_compressible_pamela_pyramid_gravity.xml | 4 +- ...10_compressible_pamela_tetra_2_regions.xml | 4 +- ...sible_pamela_tetra_2_regions_half_flow.xml | 4 +- ...0x10_compressible_pamela_tetra_gravity.xml | 4 +- ...0x10_compressible_pamela_wedge_gravity.xml | 4 +- .../singlePhaseFlow/sourceFlux_1d.xml | 4 +- .../singlePhaseFlow/sourceFlux_2d.xml | 4 +- .../singlePhaseFlow/staircase_3d.xml | 4 +- .../integratedTests/10x10x10_LaplaceFEM.xml | 4 +- .../integratedTests/50x10x5_LaplaceFEM.xml | 4 +- .../compositional_multiphase_wells_1d.xml | 4 +- .../compositional_multiphase_wells_2d.xml | 4 +- .../dead_oil_wells_2d.xml | 4 +- ...case_compositional_multiphase_wells_3d.xml | 4 +- .../compressible_single_phase_wells_1d.xml | 4 +- .../incompressible_single_phase_wells_2d.xml | 4 +- .../staircase_single_phase_wells_3d.xml | 4 +- .../integratedTests/SSLE-QS-beamBending.xml | 4 +- .../integratedTests/SSLE-sedov-cuda.xml | 4 +- .../integratedTests/sedov_base.xml | 4 +- .../integratedTests/solidMechBlock.xml | 4 +- .../DryFrac_StaticPenny_PrismElem.xml | 4 +- ...yFrac_ThreeNodesPinched_HorizontalFrac.xml | 4 +- .../DryFrac_ThreeNodesPinched_SlantFrac.xml | 4 +- .../integratedTests/SurfaceGenerator.xml | 4 +- ...eservoirCompositionalMultiphaseMSWells.xml | 4 +- .../pygeos/tests/generate_test_xml.py | 4 +- .../Tutorial.rst.depricate | 8 +- 68 files changed, 169 insertions(+), 391 deletions(-) rename src/coreComponents/dataRepository/{SidreWrapper.cpp => ConduitRestart.cpp} (98%) rename src/coreComponents/dataRepository/{SidreWrapper.hpp => ConduitRestart.hpp} (93%) rename src/coreComponents/dataRepository/unitTests/{testSidreBasic.cpp => testRestartBasic.cpp} (98%) rename src/coreComponents/dataRepository/unitTests/{testSidreExtended.cpp => testRestartExtended.cpp} (92%) diff --git a/examples/advanced_xml_features/included/included_b.xml b/examples/advanced_xml_features/included/included_b.xml index 461217f22c2..5512a57f05c 100644 --- a/examples/advanced_xml_features/included/included_b.xml +++ b/examples/advanced_xml_features/included/included_b.xml @@ -13,7 +13,7 @@ + target="/Outputs/restartOutput"/> @@ -48,6 +48,6 @@ - + - \ No newline at end of file + diff --git a/examples/advanced_xml_features/parameters_example.xml b/examples/advanced_xml_features/parameters_example.xml index 291ae0f0793..27a9dc770f1 100644 --- a/examples/advanced_xml_features/parameters_example.xml +++ b/examples/advanced_xml_features/parameters_example.xml @@ -68,7 +68,7 @@ XML Units: + target="/Outputs/restartOutput"/> @@ -103,7 +103,7 @@ XML Units: - + @@ -156,4 +156,4 @@ XML Units: scale="5e6" setNames="{sink}"/> - \ No newline at end of file + diff --git a/examples/advanced_xml_features/symbolic_math_example.xml b/examples/advanced_xml_features/symbolic_math_example.xml index 13a42200016..cf34a4ddf13 100644 --- a/examples/advanced_xml_features/symbolic_math_example.xml +++ b/examples/advanced_xml_features/symbolic_math_example.xml @@ -80,7 +80,7 @@ XML Symbolic Math: + target="/Outputs/restartOutput"/> @@ -115,7 +115,7 @@ XML Symbolic Math: - + @@ -168,4 +168,4 @@ XML Symbolic Math: scale="5e6" setNames="{sink}"/> - \ No newline at end of file + diff --git a/examples/event_examples.xml b/examples/event_examples.xml index 9380548298d..4d75a7134c6 100644 --- a/examples/event_examples.xml +++ b/examples/event_examples.xml @@ -23,7 +23,7 @@ that will cause it to be triggered at a time equal to a multiple of timeFrequency --> + target="/Outputs/restartOutput"/> @@ -77,7 +77,7 @@ - + diff --git a/integratedTests b/integratedTests index a15049a1290..3e2f3ae5d88 160000 --- a/integratedTests +++ b/integratedTests @@ -1 +1 @@ -Subproject commit a15049a1290fd13062feb04e48c25b0229d2dcf2 +Subproject commit 3e2f3ae5d88ce91bc91b68ae25efa85b85dfc3f6 diff --git a/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp b/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp index e79e5ca643a..4b1bfc1cf5a 100644 --- a/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp +++ b/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp @@ -122,12 +122,15 @@ TEST( testGeosxTraits, has_resize_method ) static_assert( has_resize_method< array1d< double > >, "Should be true." ); static_assert( has_resize_method< array5d< array1d< R1Tensor > > >, "Should be true." ); static_assert( has_resize_method< std::vector< int > >, "Should be true." ); + static_assert( has_resize_method< ArrayOfArrays< int > >, "Should be true." ); + static_assert( has_resize_method< ArrayOfSets< int > >, "Should be true." ); static_assert( !has_resize_method< SortedArray< string > >, "Should be false." ); static_assert( !has_resize_method< std::map< string, string > >, "Should be false." ); static_assert( !has_resize_method< int >, "Should be false." ); static_assert( !has_resize_method< double >, "Should be false." ); static_assert( !has_resize_method< R2SymTensor >, "Should be false." ); + } TEST( testGeosxTraits, has_resize_default_method ) diff --git a/src/coreComponents/common/DataTypes.hpp b/src/coreComponents/common/DataTypes.hpp index 69db626507f..6147db8a3b1 100644 --- a/src/coreComponents/common/DataTypes.hpp +++ b/src/coreComponents/common/DataTypes.hpp @@ -135,13 +135,13 @@ using buffer_type = std::vector< buffer_unit_type >; template< typename T, int NDIM, typename PERMUTATION=camp::make_idx_seq_t< NDIM >, - template< typename ... > class DATA_VECTOR_TYPE=LvArray::ChaiBuffer > + template< typename > class DATA_VECTOR_TYPE=LvArray::ChaiBuffer > using Array = LvArray::Array< T, NDIM, PERMUTATION, localIndex, DATA_VECTOR_TYPE >; template< typename T, int NDIM, int UNIT_STRIDE_DIM = NDIM - 1, - template< typename ... > class DATA_VECTOR_TYPE=LvArray::ChaiBuffer > + template< typename > class DATA_VECTOR_TYPE=LvArray::ChaiBuffer > using ArrayView = LvArray::ArrayView< T, NDIM, UNIT_STRIDE_DIM, localIndex, DATA_VECTOR_TYPE >; template< typename T, int NDIM, int UNIT_STRIDE_DIM = NDIM - 1 > diff --git a/src/coreComponents/cxx-utilities b/src/coreComponents/cxx-utilities index 42b26f56c79..2c2b0fe57bd 160000 --- a/src/coreComponents/cxx-utilities +++ b/src/coreComponents/cxx-utilities @@ -1 +1 @@ -Subproject commit 42b26f56c790a29a3f84b3b613a25747cc94b135 +Subproject commit 2c2b0fe57bd8911163e1b2c951d740e0966bf47b diff --git a/src/coreComponents/dataRepository/CMakeLists.txt b/src/coreComponents/dataRepository/CMakeLists.txt index 43a8fe84d2e..91b165333a0 100644 --- a/src/coreComponents/dataRepository/CMakeLists.txt +++ b/src/coreComponents/dataRepository/CMakeLists.txt @@ -13,7 +13,7 @@ set(dataRepository_headers ObjectCatalog.hpp ReferenceWrapper.hpp RestartFlags.hpp - SidreWrapper.hpp + ConduitRestart.hpp WrapperHelpers.hpp Wrapper.hpp WrapperBase.hpp @@ -25,7 +25,7 @@ set(dataRepository_headers # set(dataRepository_sources Group.cpp - SidreWrapper.cpp + ConduitRestart.cpp Wrapper.cpp WrapperBase.cpp xmlWrapper.cpp diff --git a/src/coreComponents/dataRepository/SidreWrapper.cpp b/src/coreComponents/dataRepository/ConduitRestart.cpp similarity index 98% rename from src/coreComponents/dataRepository/SidreWrapper.cpp rename to src/coreComponents/dataRepository/ConduitRestart.cpp index 2de85043258..08b3731ada8 100644 --- a/src/coreComponents/dataRepository/SidreWrapper.cpp +++ b/src/coreComponents/dataRepository/ConduitRestart.cpp @@ -13,11 +13,11 @@ */ /** - * @file SidreWrapper.cpp + * @file ConduitRestart.cpp */ // Source includes -#include "SidreWrapper.hpp" +#include "ConduitRestart.hpp" #include "mpiCommunications/MpiWrapper.hpp" #include "common/TimingMacros.hpp" #include "fileIO/utils/utils.hpp" diff --git a/src/coreComponents/dataRepository/SidreWrapper.hpp b/src/coreComponents/dataRepository/ConduitRestart.hpp similarity index 93% rename from src/coreComponents/dataRepository/SidreWrapper.hpp rename to src/coreComponents/dataRepository/ConduitRestart.hpp index 06bc7de801c..707626b6b7f 100644 --- a/src/coreComponents/dataRepository/SidreWrapper.hpp +++ b/src/coreComponents/dataRepository/ConduitRestart.hpp @@ -13,11 +13,11 @@ */ /** - * @file SidreWrapper.hpp + * @file ConduitRestart.hpp */ -#ifndef GEOSX_DATAREPOSITORY_SIDREWRAPPER_HPP_ -#define GEOSX_DATAREPOSITORY_SIDREWRAPPER_HPP_ +#ifndef GEOSX_DATAREPOSITORY_CONDUITRESTART_HPP_ +#define GEOSX_DATAREPOSITORY_CONDUITRESTART_HPP_ // Source includes #include "common/GeosxConfig.hpp" @@ -92,4 +92,4 @@ void loadTree( std::string const & path ); } // namespace dataRepository } // namespace geosx -#endif /* GEOSX_DATAREPOSITORY_SIDREWRAPPER_HPP_ */ +#endif /* GEOSX_DATAREPOSITORY_CONDUITRESTART_HPP_ */ diff --git a/src/coreComponents/dataRepository/Group.cpp b/src/coreComponents/dataRepository/Group.cpp index 60fecaba30e..e21d831dd51 100644 --- a/src/coreComponents/dataRepository/Group.cpp +++ b/src/coreComponents/dataRepository/Group.cpp @@ -18,7 +18,7 @@ #include "codingUtilities/StringUtilities.hpp" #include "common/TimingMacros.hpp" -#include "dataRepository/SidreWrapper.hpp" +#include "dataRepository/ConduitRestart.hpp" namespace geosx { diff --git a/src/coreComponents/dataRepository/Wrapper.hpp b/src/coreComponents/dataRepository/Wrapper.hpp index 8e85c447dae..69a47cec0ff 100644 --- a/src/coreComponents/dataRepository/Wrapper.hpp +++ b/src/coreComponents/dataRepository/Wrapper.hpp @@ -135,28 +135,6 @@ class Wrapper : public WrapperBase //tvTemplateInstantiation(); } - /** - * Copy Constructor - * @param source source for the copy - */ - Wrapper( Wrapper const & source ): - WrapperBase( "copy_constructor_test", nullptr ), - m_ownsData( source.m_ownsData ), - m_data( source.m_data ), - m_default( source.m_default ) - {} - - /** - * Move Constructor - * @param source source to be moved - */ - Wrapper( Wrapper && source ): - WrapperBase( source ), - m_ownsData( source.m_ownsData ), - m_data( std::move( source.m_data ) ), - m_default( source.m_default ) - {} - /** * Copy Assignment Operator * @param source rhs @@ -380,80 +358,11 @@ class Wrapper : public WrapperBase return unpackedSize; } - - - /// @cond DO_NOT_DOCUMENT - struct empty_wrapper - { - template< class U = T > - static typename std::enable_if< traits::has_empty_method< U >, bool >::type - empty( Wrapper< T > const * parent ) - { - return parent->m_data->empty(); - } - template< class U = T > - static typename std::enable_if< !traits::has_empty_method< U >, bool >::type - empty( Wrapper< T > const * parent ) - { - return parent; - } - };/// @endcond DO_NOT_DOCUMENT - virtual bool empty() const override final - { - return empty_wrapper::empty( this ); - } - virtual localIndex size() const override final { return wrapperHelpers::size( *m_data ); } - - /// @cond DO_NOT_DOCUMENT - struct num_dimensions_wrapper - { - HAS_MEMBER_FUNCTION( numDimensions, int, const, , ) - - template< class U = T > - static typename std::enable_if< has_memberfunction_numDimensions< U >::value, int >::type - numDimensions( Wrapper< T > const * parent ) - { return static_cast< int >(parent->m_data->numDimensions()); } - - template< class U = T > - static typename std::enable_if< !has_memberfunction_numDimensions< U >::value, int >::type - numDimensions( Wrapper< T > const * GEOSX_UNUSED_ARG( parent ) ) - { return 1; } - };/// @endcond DO_NOT_DOCUMENT - virtual int numDimensions() const override final - { - return num_dimensions_wrapper::numDimensions( this ); - } - - /// @cond DO_NOT_DOCUMENT - struct dimension_size_wrapper - { - template< class U = T > - static typename std::enable_if< traits::has_dimension_size_method< U >, localIndex >::type - size( Wrapper< T > const * const parent, int const i ) - { return integer_conversion< localIndex >( parent->m_data->size( i )); } - - template< class U = T > - static typename std::enable_if< !traits::has_dimension_size_method< U >, localIndex >::type - size( Wrapper< T > const * const parent, int const i ) - { - if( i != 0 ) - { - GEOS_ERROR( "Data is only 1D" ); - return 0; - } - return parent->size(); - } - };/// @endcond DO_NOT_DOCUMENT - virtual localIndex size( int const i ) const override final - { - return dimension_size_wrapper::size( this, i ); - } - virtual void resize( int ndims, localIndex const * const dims ) override final { wrapperHelpers::resizeDimensions( *m_data, ndims, dims ); } @@ -480,15 +389,6 @@ class Wrapper : public WrapperBase HAS_MEMBER_FUNCTION( capacity, std::size_t, const, , ) CONDITIONAL_VIRTUAL_FUNCTION0( Wrapper< T >, capacity, std::size_t, const ) - HAS_MEMBER_FUNCTION( max_size, std::size_t, const, , ) - CONDITIONAL_VIRTUAL_FUNCTION0( Wrapper< T >, max_size, std::size_t, const ) - - HAS_MEMBER_FUNCTION( clear, void, , , ) - CONDITIONAL_VIRTUAL_FUNCTION0( Wrapper< T >, clear, void, ) - - HAS_MEMBER_FUNCTION( insert, void, , , ) - CONDITIONAL_VIRTUAL_FUNCTION0( Wrapper< T >, insert, void, ) - virtual void resize( localIndex const newSize ) override final { wrapperHelpers::resizeDefault( *m_data, newSize, m_default ); @@ -683,78 +583,9 @@ class Wrapper : public WrapperBase virtual void move( chai::ExecutionSpace space, bool touch ) override { return move_wrapper::move( *m_data, space, touch ); } - - /** - * @brief function to get the size of T - * @return size of T - */ - template< class U = T > - typename std::enable_if< traits::has_alias_value_type< U >, size_t >::type - sizeOfValueType() const - { - return sizeof(typename T::value_type); - } - - /** - * @brief function to get the size of T - * @return size of T - */ - template< class U = T > - typename std::enable_if< !traits::has_alias_value_type< U >, size_t >::type - sizeOfValueType() const - { - return sizeof(T); - } - - virtual size_t sizeOfType() const override final - { - return sizeOfValueType(); - } - - /** - * @brief case for if U::value_type exists. Returns the size of an element of dataPtr - * @return size of T::value_type - */ - template< class U = T > - typename std::enable_if< traits::has_alias_value_type< U >, localIndex >::type - elementSize() const - { - return sizeof(typename T::value_type); - } - - /** - * @brief case for if U::value_type doesn't exists. Returns the size of an element of dataPtr - * @return size of T::value_type - */ - template< class U = T > - typename std::enable_if< !traits::has_alias_value_type< U >, localIndex >::type - elementSize() const - { - return sizeof(T); - } - - - /// case for if U::value_type exists. Returns the typeid of an element of dataPtr - template< class U = T > - typename std::enable_if< traits::has_alias_value_type< U >, const std::type_info & >::type - elementTypeID() const - { - return typeid(typename T::value_type); - } - - - /// case for if U::value_type doesn't exists. Returns the typeid of an element of dataPtr - template< class U = T > - typename std::enable_if< !traits::has_alias_value_type< U >, const std::type_info & >::type - elementTypeID() const - { - return typeid(T); - } - - /// @cond DO_NOT_DOCUMENT - /* Register the pointer to data with the associated sidre::View. */ + /* Register the pointer to data with the associated conduit::Node. */ void registerToWrite() override { getConduitNode().reset(); @@ -771,7 +602,7 @@ class Wrapper : public WrapperBase wrapperHelpers::pushDataToConduitNode( *m_data, getConduitNode() ); } - /* Register the pointer to data with the associated sidre::View. */ + /* Register the pointer to data with the associated conduit::Node. */ void finishWriting() override { getConduitNode().reset(); diff --git a/src/coreComponents/dataRepository/WrapperBase.hpp b/src/coreComponents/dataRepository/WrapperBase.hpp index db9f953b4c0..274e7169654 100644 --- a/src/coreComponents/dataRepository/WrapperBase.hpp +++ b/src/coreComponents/dataRepository/WrapperBase.hpp @@ -62,13 +62,6 @@ class WrapperBase */ virtual ~WrapperBase(); - /** - * @brief move operator - * @param[in] source - */ - // WrapperBase( WrapperBase && source ); - - virtual void CopyWrapperAttributes( WrapperBase const & source ); /** @@ -78,30 +71,12 @@ class WrapperBase virtual std::type_info const & get_typeid() const = 0; - /** - * @brief function call T::empty() - * @return boolean true if T is empty, false if not. - */ - virtual bool empty() const = 0; - /** * @brief function to call T::size() * @return result of T::size() */ virtual localIndex size() const = 0; - /** - * @brief function to call T::numDimensions() - * @return result of T::numDimensions() - */ - virtual int numDimensions() const = 0; - - /** - * @brief function to call T::size(int) - * @return result of T::size(int) - */ - virtual localIndex size( int i ) const = 0; - /** * @brief function to call T::resize( num_dims, dims ) * @param[in] num_dims number of dimensions in T @@ -121,24 +96,6 @@ class WrapperBase */ virtual std::size_t capacity() const = 0; - /** - * @brief function to call T::max_size() - * @return result of T::max_size() - */ - virtual std::size_t max_size() const = 0; - - /** - * @brief function to call T::clear() - * @return result of T::clear() - */ - virtual void clear() = 0; - - /** - * @brief function to call T::insert() - * @return result of T::insert() - */ - virtual void insert() = 0; - /** * @brief function to call T::resize(newsize) * @param[in] newsize parameter to pass to T::resize(newsize) @@ -146,6 +103,13 @@ class WrapperBase */ virtual void resize( localIndex newsize ) = 0; + /** + * + * @param sourceIndex + * @param destIndex + */ + virtual void copy( localIndex const sourceIndex, localIndex const destIndex ) = 0; + /** * @brief function to create a clone of *this WrapperBase @@ -161,12 +125,6 @@ class WrapperBase virtual void move( chai::ExecutionSpace space, bool touch ) = 0; - /** - * - * @return - */ - virtual size_t sizeOfType() const = 0; - /** * * @param view @@ -190,13 +148,6 @@ class WrapperBase */ void resize(); - /** - * - * @param sourceIndex - * @param destIndex - */ - virtual void copy( localIndex const sourceIndex, localIndex const destIndex ) = 0; - /** * * @return diff --git a/src/coreComponents/dataRepository/WrapperHelpers.hpp b/src/coreComponents/dataRepository/WrapperHelpers.hpp index 7e5e8190446..01f347ebe4f 100644 --- a/src/coreComponents/dataRepository/WrapperHelpers.hpp +++ b/src/coreComponents/dataRepository/WrapperHelpers.hpp @@ -24,7 +24,7 @@ // Source includes #include "BufferOps.hpp" #include "DefaultValue.hpp" -#include "SidreWrapper.hpp" +#include "ConduitRestart.hpp" #include "common/DataTypes.hpp" #include "common/GeosxMacros.hpp" #include "codingUtilities/GeosxTraits.hpp" @@ -322,7 +322,7 @@ pushDataToConduitNode( Array< T, NDIM, PERMUTATION > const & var, node[ "__dimensions__" ].set( dimensionType, temp ); // Create a copy of the permutation - std::array< camp::idx_t, NDIM > const perm = var.getPermutation(); + constexpr std::array< camp::idx_t, NDIM > const perm = RAJA::as_array< PERMUTATION >::get(); for( int i = 0 ; i < NDIM ; ++i ) { temp[ i ] = perm[ i ]; @@ -351,11 +351,11 @@ pullDataFromConduitNode( Array< T, NDIM, PERMUTATION > & var, conduit::Node const & permutationNode = node.fetch_child( "__permutation__" ); GEOS_ERROR_IF_NE( permutationNode.dtype().number_of_elements(), totalNumDimensions ); - std::array< camp::idx_t, NDIM > const permutation = var.getPermutation(); + constexpr std::array< camp::idx_t, NDIM > const perm = RAJA::as_array< PERMUTATION >::get(); camp::idx_t const * const permFromConduit = permutationNode.value(); for( int i = 0 ; i < NDIM ; ++i ) { - GEOS_ERROR_IF_NE_MSG( permFromConduit[ i ], permutation[ i ], + GEOS_ERROR_IF_NE_MSG( permFromConduit[ i ], perm[ i ], "The permutation of the data in conduit and the provided Array don't match." ); } diff --git a/src/coreComponents/dataRepository/unitTests/CMakeLists.txt b/src/coreComponents/dataRepository/unitTests/CMakeLists.txt index 1286983fc6a..327d5577a8b 100644 --- a/src/coreComponents/dataRepository/unitTests/CMakeLists.txt +++ b/src/coreComponents/dataRepository/unitTests/CMakeLists.txt @@ -5,8 +5,8 @@ set( dataRepository_tests testDefaultValue.cpp testObjectCatalog.cpp - testSidreBasic.cpp - testSidreExtended.cpp + testRestartBasic.cpp + testRestartExtended.cpp testWrapper.cpp testXmlWrapper.cpp testBufferOps.cpp diff --git a/src/coreComponents/dataRepository/unitTests/testSidreBasic.cpp b/src/coreComponents/dataRepository/unitTests/testRestartBasic.cpp similarity index 98% rename from src/coreComponents/dataRepository/unitTests/testSidreBasic.cpp rename to src/coreComponents/dataRepository/unitTests/testRestartBasic.cpp index 3aefc216a90..847ca50c1aa 100644 --- a/src/coreComponents/dataRepository/unitTests/testSidreBasic.cpp +++ b/src/coreComponents/dataRepository/unitTests/testRestartBasic.cpp @@ -17,7 +17,7 @@ #include "managers/initialization.hpp" #include "dataRepository/Group.hpp" #include "dataRepository/Wrapper.hpp" -#include "dataRepository/SidreWrapper.hpp" +#include "dataRepository/ConduitRestart.hpp" #include "mpiCommunications/MpiWrapper.hpp" // TPL includes @@ -218,7 +218,7 @@ class SingleWrapperTest : public ::testing::Test private: std::string const m_groupName = "root"; std::string const m_wrapperName = "wrapper"; - std::string const m_fileName = "testSidreBasic_SingleWrapperTest"; + std::string const m_fileName = "testRestartBasic_SingleWrapperTest"; Group * m_group; int m_groupSize; diff --git a/src/coreComponents/dataRepository/unitTests/testSidreExtended.cpp b/src/coreComponents/dataRepository/unitTests/testRestartExtended.cpp similarity index 92% rename from src/coreComponents/dataRepository/unitTests/testSidreExtended.cpp rename to src/coreComponents/dataRepository/unitTests/testRestartExtended.cpp index d457e924644..ca1a5c8ac93 100644 --- a/src/coreComponents/dataRepository/unitTests/testSidreExtended.cpp +++ b/src/coreComponents/dataRepository/unitTests/testRestartExtended.cpp @@ -16,7 +16,7 @@ #include "common/DataTypes.hpp" #include "managers/initialization.hpp" #include "dataRepository/Group.hpp" -#include "dataRepository/SidreWrapper.hpp" +#include "dataRepository/ConduitRestart.hpp" #include "dataRepository/Wrapper.hpp" // TPL includes @@ -38,10 +38,10 @@ Wrapper< array1d< T > > * createArrayView( Group * parent, const string & name, view->setSizedFromParent( sfp ); /* Resize the array */ - view->resize( data.size()); + view->resize( data.size() ); /* Check that the Wrapper size and byteSize return the proper values */ - EXPECT_EQ( view->size(), data.size()); + EXPECT_EQ( view->size(), data.size() ); /* Set the data */ array1d< T > & view_data = view->reference(); @@ -51,7 +51,7 @@ Wrapper< array1d< T > > * createArrayView( Group * parent, const string & name, } /* Check that the Wrapper dataPtr points to the right thing */ - EXPECT_EQ( view->dataPtr(), view_data.data()); + EXPECT_EQ( view->dataPtr(), view_data.data() ); return view; } @@ -61,7 +61,7 @@ template< typename T > void checkArrayView( const Wrapper< array1d< T > > * view, int sfp, const array1d< T > & data ) { EXPECT_EQ( view->sizedFromParent(), sfp ); - EXPECT_EQ( view->size(), data.size()); + EXPECT_EQ( view->size(), data.size() ); array1d< T > const & view_data = view->reference(); for( int i = 0 ; i < view->size() ; i++ ) { @@ -83,9 +83,7 @@ Wrapper< array2d< T > > * createArray2dView( Group * parent, const string & name view->resize( 2, dims ); /* Check that the Wrapper size and byteSize return the proper values */ - EXPECT_EQ( view->size( 0 ), data.size( 0 )); - EXPECT_EQ( view->size( 1 ), data.size( 1 )); - EXPECT_EQ( view->size(), data.size()); + EXPECT_EQ( view->size(), data.size() ); /* Set the data */ array2d< T > & view_data = view->reference(); @@ -108,9 +106,7 @@ template< typename T > void checkArray2dView( const Wrapper< array2d< T > > * view, int sfp, const array2d< T > & data ) { EXPECT_EQ( view->sizedFromParent(), sfp ); - EXPECT_EQ( view->size(), data.size()); - EXPECT_EQ( view->size( 0 ), data.size( 0 )); - EXPECT_EQ( view->size( 1 ), data.size( 1 )); + EXPECT_EQ( view->size(), data.size() ); const array2d< T > & view_data = view->reference(); for( int i = 0 ; i < data.size( 0 ) ; i++ ) @@ -129,16 +125,16 @@ Wrapper< set< T > > * createSetView( Group * parent, const string & name, localIndex sfp, const set< T > & data ) { Wrapper< set< T > > * view = parent->registerWrapper< set< T > >( name ); - view->setSizedFromParent( int(sfp)); + view->setSizedFromParent( int(sfp) ); /* Insert the data */ - view->reference().insert( data.values(), data.size()); + view->reference().insert( data.values(), data.size() ); /* Check that the Wrapper size and byteSize return the proper values */ - EXPECT_EQ( view->size(), data.size()); + EXPECT_EQ( view->size(), data.size() ); /* Check that the Wrapper dataPtr points to the right thing */ - EXPECT_EQ( view->dataPtr(), view->reference().values()); + EXPECT_EQ( view->dataPtr(), view->reference().values() ); return view; } @@ -148,7 +144,7 @@ template< typename T > void checkSetView( const Wrapper< set< T > > * view, localIndex sfp, const set< T > & data ) { EXPECT_EQ( view->sizedFromParent(), sfp ); - EXPECT_EQ( view->size(), data.size()); + EXPECT_EQ( view->size(), data.size() ); const set< T > & view_data = view->reference(); for( int i = 0 ; i < view->size() ; i++ ) { @@ -167,10 +163,10 @@ Wrapper< string > * createStringView( Group * parent, const string & name, view->reference() = str; /* Check that the Wrapper size and byteSize return the proper values */ - EXPECT_EQ( static_cast< uint >(view->size()), str.size()); + EXPECT_EQ( static_cast< uint >(view->size() ), str.size() ); /* Check that the Wrapper dataPtr points to the right thing */ - EXPECT_EQ( view->dataPtr(), view->reference().c_str()); + EXPECT_EQ( view->dataPtr(), view->reference().c_str() ); return view; } @@ -189,9 +185,9 @@ Wrapper< string_array > * createStringArrayView( Group * parent, const string & Wrapper< string_array > * view = parent->registerWrapper< string_array >( name ); view->setSizedFromParent( sfp ); - view->resize( static_cast< localIndex >(arr.size())); + view->resize( static_cast< localIndex >(arr.size() )); - EXPECT_EQ( static_cast< uint >(view->size()), arr.size()); + EXPECT_EQ( static_cast< uint >(view->size() ), arr.size() ); string_array & view_data = view->reference(); for( localIndex i = 0 ; i < arr.size() ; ++i ) @@ -199,7 +195,7 @@ Wrapper< string_array > * createStringArrayView( Group * parent, const string & view_data[i] = arr[i]; } - EXPECT_EQ( view->dataPtr(), view_data.data()); + EXPECT_EQ( view->dataPtr(), view_data.data() ); return view; } @@ -207,7 +203,7 @@ Wrapper< string_array > * createStringArrayView( Group * parent, const string & void checkStringArrayView( const Wrapper< string_array > * view, const int sfp, const string_array & arr ) { EXPECT_EQ( view->sizedFromParent(), sfp ); - EXPECT_EQ( view->size(), arr.size()); + EXPECT_EQ( view->size(), arr.size() ); string_array const & view_data = view->reference(); for( int i = 0 ; i < view->size() ; i++ ) { @@ -229,7 +225,7 @@ Wrapper< T > * createScalarView( Group * parent, const string & name, EXPECT_EQ( view->size(), 1 ); /* Check that the Wrapper dataPtr points to the right thing */ - EXPECT_EQ( *(view->dataPtr()), value ); + EXPECT_EQ( *(view->dataPtr() ), value ); return view; } @@ -242,13 +238,13 @@ void checkScalarView( const Wrapper< T > * view, int sfp, const T value ) { } -TEST( testSidreExtended, testSidreExtended ) +TEST( testRestartExtended, testRestartExtended ) { - const string path = "test_sidre_extended"; + const string path = "testRestartExtended"; const int group_size = 44; int sfp = 55; - /* Create a new Group directly below the sidre::DataStore root. */ + /* Create a new Group directly below the conduit root. */ Group * root = new Group( std::string( "data" ), nullptr ); root->resize( group_size ); @@ -427,20 +423,20 @@ TEST( testSidreExtended, testSidreExtended ) - /* Save the sidre tree */ + /* Save the conduit tree */ root->prepareToWrite(); writeTree( path ); root->finishWriting(); - /* Delete geos tree and reset sidre tree. */ + /* Delete geos tree and reset conduit tree. */ delete root; rootConduitNode.reset(); - /* Restore the sidre tree */ + /* Restore the conduit tree */ loadTree( path ); root = new Group( std::string( "data" ), nullptr ); - /* Create dual GEOS tree. Groups automatically register with the associated sidre::View. */ + /* Create dual GEOS tree. Groups automatically register with the associated conduit::Node. */ Wrapper< globalIndex_array > * view_globalIndex_new = root->registerWrapper< globalIndex_array >( view_globalIndex_name ); Wrapper< string > * view_hope_new = root->registerWrapper< string >( view_hope_name ); Wrapper< string_array > * view_restart_new = root->registerWrapper< string_array >( view_restart_name ); diff --git a/src/coreComponents/managers/DomainPartition.cpp b/src/coreComponents/managers/DomainPartition.cpp index b90675b41dc..2ecafe2454e 100644 --- a/src/coreComponents/managers/DomainPartition.cpp +++ b/src/coreComponents/managers/DomainPartition.cpp @@ -131,7 +131,7 @@ void DomainPartition::GenerateSets() { localIndex const numNodes = subRegion->numNodesPerElement( k ); - localIndex elementInSet = true;; + localIndex elementInSet = true; for ( localIndex i = 0; i < numNodes; ++i ) { if ( !nodeInCurSet( elemToNodeMap[ k ][ i ] ) ) diff --git a/src/coreComponents/managers/Outputs/RestartOutput.cpp b/src/coreComponents/managers/Outputs/RestartOutput.cpp index eb8c0268d4a..afde3adc1ef 100644 --- a/src/coreComponents/managers/Outputs/RestartOutput.cpp +++ b/src/coreComponents/managers/Outputs/RestartOutput.cpp @@ -46,7 +46,6 @@ void RestartOutput::Execute(real64 const GEOSX_UNUSED_ARG( time_n ), real64 const GEOSX_UNUSED_ARG( eventProgress ), Group * domain) { -#ifdef GEOSX_USE_ATK GEOSX_MARK_FUNCTION; DomainPartition* domainPartition = Group::group_cast(domain); @@ -60,13 +59,10 @@ void RestartOutput::Execute(real64 const GEOSX_UNUSED_ARG( time_n ), problemManager->prepareToWrite(); FunctionManager::Instance()->prepareToWrite(); FieldSpecificationManager::get()->prepareToWrite(); - int numFiles; - MPI_Comm_size( MPI_COMM_GEOSX, &numFiles ); writeTree( fileName ); problemManager->finishWriting(); FunctionManager::Instance()->finishWriting(); FieldSpecificationManager::get()->finishWriting(); -#endif } diff --git a/src/coreComponents/managers/ProblemManager.cpp b/src/coreComponents/managers/ProblemManager.cpp index 17c4eb0d9d6..b074c0c64e4 100644 --- a/src/coreComponents/managers/ProblemManager.cpp +++ b/src/coreComponents/managers/ProblemManager.cpp @@ -33,7 +33,7 @@ #include "fileIO/utils/utils.hpp" #include "finiteElement/FiniteElementDiscretizationManager.hpp" #include "meshUtilities/SimpleGeometricObjects/SimpleGeometricObjectBase.hpp" -#include "dataRepository/SidreWrapper.hpp" +#include "dataRepository/ConduitRestart.hpp" #include "dataRepository/RestartFlags.hpp" #include "mesh/MeshBody.hpp" #include "wells/InternalWellGenerator.hpp" @@ -511,7 +511,8 @@ void ProblemManager::GenerateDocumentation() MeshManager * meshManager = this->GetGroup(groupKeys.meshManager); DomainPartition * domain = getDomainPartition(); meshManager->GenerateMeshLevels(domain); - RegisterDataOnMeshRecursive(domain->getMeshBodies()); + + RegisterDataOnMeshRecursive( domain->getMeshBodies() ); // Generate schema SchemaUtilities::ConvertDocumentationToSchema(schemaName.c_str(), this, 0); diff --git a/src/coreComponents/managers/docs/EventManager.rst b/src/coreComponents/managers/docs/EventManager.rst index 99cfe9bf2a2..24c0ba047de 100644 --- a/src/coreComponents/managers/docs/EventManager.rst +++ b/src/coreComponents/managers/docs/EventManager.rst @@ -112,7 +112,7 @@ For example, consider the following Events block: + target="/Outputs/restartOutput"/> In this case, the events solverApplications_a and solverApplications_b point target physics events. The eventCounter, eventProgress pairs will be: outputs (0, 0.0), solverApplications_a (1, 0.0), solverApplications_b (2, 0.5), and restarts (3, 1.0). These values are supplied to the target events via their Execute methods for use. For example, for the name of a silo output file will have the format: "%s_%06d%02d" % (name, cycle, eventCounter), and the time listed in the file will be ``time = time + dt*eventProgress`` diff --git a/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/Hydrofracture_KGD_EdgeBased_C3D6.xml b/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/Hydrofracture_KGD_EdgeBased_C3D6.xml index f2e848b03bb..1a4f74fd3d8 100644 --- a/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/Hydrofracture_KGD_EdgeBased_C3D6.xml +++ b/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/Hydrofracture_KGD_EdgeBased_C3D6.xml @@ -135,7 +135,7 @@ @@ -285,7 +285,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/Hydrofracture_KGD_NodeBased_C3D6.xml b/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/Hydrofracture_KGD_NodeBased_C3D6.xml index 75dac842167..8b6a82417a5 100644 --- a/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/Hydrofracture_KGD_NodeBased_C3D6.xml +++ b/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/Hydrofracture_KGD_NodeBased_C3D6.xml @@ -135,7 +135,7 @@ + target="/Outputs/restartOutput"/> @@ -284,7 +284,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/Hydrofracture_SinglePhase_2d.xml b/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/Hydrofracture_SinglePhase_2d.xml index 236506329cb..e83bfd41540 100644 --- a/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/Hydrofracture_SinglePhase_2d.xml +++ b/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/Hydrofracture_SinglePhase_2d.xml @@ -130,7 +130,7 @@ @@ -272,7 +272,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/KGDTest_GEOSX.xml b/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/KGDTest_GEOSX.xml index b4953a30bc6..67c3d6faf30 100644 --- a/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/KGDTest_GEOSX.xml +++ b/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/KGDTest_GEOSX.xml @@ -134,7 +134,7 @@ @@ -284,7 +284,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/poroElastic_Mandel.xml b/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/poroElastic_Mandel.xml index e8e90b1a97c..65ce96d42f4 100644 --- a/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/poroElastic_Mandel.xml +++ b/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/poroElastic_Mandel.xml @@ -91,7 +91,7 @@ @@ -238,7 +238,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/poroElastic_Terzaghi.xml b/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/poroElastic_Terzaghi.xml index 00e0254beac..f69074589a4 100644 --- a/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/poroElastic_Terzaghi.xml +++ b/src/coreComponents/physicsSolvers/CoupledSolvers/integratedTests/poroElastic_Terzaghi.xml @@ -85,7 +85,7 @@ + target="/Outputs/restartOutput"/> @@ -223,7 +223,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/4comp_2ph_1d.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/4comp_2ph_1d.xml index df704f7dd2b..d613343054d 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/4comp_2ph_1d.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/4comp_2ph_1d.xml @@ -65,7 +65,7 @@ + target="/Outputs/restartOutput"/> @@ -260,7 +260,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/4comp_2ph_cap_1d.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/4comp_2ph_cap_1d.xml index 29f0953a73e..167150024ef 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/4comp_2ph_cap_1d.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/4comp_2ph_cap_1d.xml @@ -65,7 +65,7 @@ + target="/Outputs/restartOutput"/> @@ -268,7 +268,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/blackoil_2ph_1d.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/blackoil_2ph_1d.xml index 3975e24722c..a2209aaaf6f 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/blackoil_2ph_1d.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/blackoil_2ph_1d.xml @@ -67,7 +67,7 @@ + target="/Outputs/restartOutput"/> @@ -234,7 +234,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/deadoil_3ph_baker_1d.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/deadoil_3ph_baker_1d.xml index dbda5ecd49d..bc58180bc3d 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/deadoil_3ph_baker_1d.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/deadoil_3ph_baker_1d.xml @@ -61,7 +61,7 @@ + target="/Outputs/restartOutput"/> @@ -231,7 +231,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/deadoil_3ph_corey_1d.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/deadoil_3ph_corey_1d.xml index f8676195b25..cbb1a995cf1 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/deadoil_3ph_corey_1d.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/deadoil_3ph_corey_1d.xml @@ -61,7 +61,7 @@ + target="/Outputs/restartOutput"/> @@ -229,7 +229,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/deadoil_3ph_staircase_3d.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/deadoil_3ph_staircase_3d.xml index f0ba14d1ba4..972a09a7b9b 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/deadoil_3ph_staircase_3d.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/compositionalMultiphaseFlow/deadoil_3ph_staircase_3d.xml @@ -69,7 +69,7 @@ + target="/Outputs/restartOutput"/> @@ -246,6 +246,6 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/compressible_1d.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/compressible_1d.xml index 09427703f3b..94230b8ed0a 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/compressible_1d.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/compressible_1d.xml @@ -49,7 +49,7 @@ + target="/Outputs/restartOutput"/> @@ -137,7 +137,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/fractureFlow_2d.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/fractureFlow_2d.xml index d08f67c6b48..76d4bc7cd35 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/fractureFlow_2d.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/fractureFlow_2d.xml @@ -98,7 +98,7 @@ name="restarts" timeFrequency="5.0" targetExactTimestep="0" - target="/Outputs/sidreRestart" /> + target="/Outputs/restartOutput" /> @@ -183,7 +183,7 @@ name="siloOutput" plotFileRoot="fractureFlow" plotLevel="2" /> - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/fractureJunctionFlow_2d.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/fractureJunctionFlow_2d.xml index 9cc2c70a2e0..69ef8c8f2f7 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/fractureJunctionFlow_2d.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/fractureJunctionFlow_2d.xml @@ -69,7 +69,7 @@ + target="/Outputs/restartOutput"/> @@ -131,7 +131,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/fractureMatrixFlow_2d.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/fractureMatrixFlow_2d.xml index a62e86cbf5e..79f0b7b78b8 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/fractureMatrixFlow_2d.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/fractureMatrixFlow_2d.xml @@ -96,7 +96,7 @@ name="restarts" timeFrequency="25000" targetExactTimestep="0" - target="/Outputs/sidreRestart" /> + target="/Outputs/restartOutput" /> @@ -213,7 +213,7 @@ name="siloOutput" plotFileRoot="fractureMatrixFlow" plotLevel="1" /> - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/incompressible_1d.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/incompressible_1d.xml index 0e212c25de2..d17f2b12726 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/incompressible_1d.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/incompressible_1d.xml @@ -49,7 +49,7 @@ + target="/Outputs/restartOutput"/> @@ -137,7 +137,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_hex_gravity.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_hex_gravity.xml index 65dff14c851..2420493d8cd 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_hex_gravity.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_hex_gravity.xml @@ -46,7 +46,7 @@ @@ -135,6 +135,6 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_pyramid_gravity.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_pyramid_gravity.xml index 9e381c26ab5..484f57c7b2a 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_pyramid_gravity.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_pyramid_gravity.xml @@ -46,7 +46,7 @@ @@ -135,6 +135,6 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_tetra_2_regions.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_tetra_2_regions.xml index 83356821d4f..03561a25c0b 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_tetra_2_regions.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_tetra_2_regions.xml @@ -46,7 +46,7 @@ + target="/Outputs/restartOutput"/> @@ -168,6 +168,6 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_tetra_2_regions_half_flow.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_tetra_2_regions_half_flow.xml index 273c3db66dc..ac2a4982f1d 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_tetra_2_regions_half_flow.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_tetra_2_regions_half_flow.xml @@ -46,7 +46,7 @@ + target="/Outputs/restartOutput"/> @@ -138,6 +138,6 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_tetra_gravity.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_tetra_gravity.xml index 7156ec0017f..b9086fa5e5d 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_tetra_gravity.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_tetra_gravity.xml @@ -46,7 +46,7 @@ @@ -135,6 +135,6 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_wedge_gravity.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_wedge_gravity.xml index 946527fcc53..93233547bf8 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_wedge_gravity.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/pamela_test/3D_10x10x10_compressible_pamela_wedge_gravity.xml @@ -46,7 +46,7 @@ @@ -135,6 +135,6 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/sourceFlux_1d.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/sourceFlux_1d.xml index 0d60a919c6d..aa6daed77d1 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/sourceFlux_1d.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/sourceFlux_1d.xml @@ -49,7 +49,7 @@ + target="/Outputs/restartOutput"/> @@ -136,7 +136,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/sourceFlux_2d.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/sourceFlux_2d.xml index e7920a302f6..c6b2ca80136 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/sourceFlux_2d.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/sourceFlux_2d.xml @@ -54,7 +54,7 @@ + target="/Outputs/restartOutput"/> @@ -163,7 +163,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/staircase_3d.xml b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/staircase_3d.xml index 69f42d754a9..12f2ac3c835 100644 --- a/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/staircase_3d.xml +++ b/src/coreComponents/physicsSolvers/FiniteVolume/integratedTests/singlePhaseFlow/staircase_3d.xml @@ -49,7 +49,7 @@ + target="/Outputs/restartOutput"/> @@ -140,6 +140,6 @@ - + diff --git a/src/coreComponents/physicsSolvers/SimpleSolvers/integratedTests/10x10x10_LaplaceFEM.xml b/src/coreComponents/physicsSolvers/SimpleSolvers/integratedTests/10x10x10_LaplaceFEM.xml index d8bed8ce185..ab554cf88dc 100644 --- a/src/coreComponents/physicsSolvers/SimpleSolvers/integratedTests/10x10x10_LaplaceFEM.xml +++ b/src/coreComponents/physicsSolvers/SimpleSolvers/integratedTests/10x10x10_LaplaceFEM.xml @@ -41,7 +41,7 @@ @@ -87,7 +87,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/SimpleSolvers/integratedTests/50x10x5_LaplaceFEM.xml b/src/coreComponents/physicsSolvers/SimpleSolvers/integratedTests/50x10x5_LaplaceFEM.xml index bb8f5c7eb23..9e25ca36033 100644 --- a/src/coreComponents/physicsSolvers/SimpleSolvers/integratedTests/50x10x5_LaplaceFEM.xml +++ b/src/coreComponents/physicsSolvers/SimpleSolvers/integratedTests/50x10x5_LaplaceFEM.xml @@ -41,7 +41,7 @@ @@ -87,7 +87,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/compositional_multiphase_wells_1d.xml b/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/compositional_multiphase_wells_1d.xml index 955ce5974fc..fc8bfdc82f7 100644 --- a/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/compositional_multiphase_wells_1d.xml +++ b/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/compositional_multiphase_wells_1d.xml @@ -126,7 +126,7 @@ + target="/Outputs/restartOutput" /> @@ -258,7 +258,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/compositional_multiphase_wells_2d.xml b/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/compositional_multiphase_wells_2d.xml index 67fd167ed2b..dfa51d23ae6 100644 --- a/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/compositional_multiphase_wells_2d.xml +++ b/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/compositional_multiphase_wells_2d.xml @@ -147,7 +147,7 @@ + target="/Outputs/restartOutput" /> @@ -282,7 +282,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/dead_oil_wells_2d.xml b/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/dead_oil_wells_2d.xml index a3ff7ab0fde..5fe2ee5fa21 100644 --- a/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/dead_oil_wells_2d.xml +++ b/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/dead_oil_wells_2d.xml @@ -147,7 +147,7 @@ + target="/Outputs/restartOutput" /> @@ -268,7 +268,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/staircase_compositional_multiphase_wells_3d.xml b/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/staircase_compositional_multiphase_wells_3d.xml index bf3ee016327..6e18669b7e7 100644 --- a/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/staircase_compositional_multiphase_wells_3d.xml +++ b/src/coreComponents/physicsSolvers/Wells/integratedTests/compositionalMultiphaseWell/staircase_compositional_multiphase_wells_3d.xml @@ -108,7 +108,7 @@ + target="/Outputs/restartOutput"/> @@ -233,6 +233,6 @@ - + diff --git a/src/coreComponents/physicsSolvers/Wells/integratedTests/singlePhaseWell/compressible_single_phase_wells_1d.xml b/src/coreComponents/physicsSolvers/Wells/integratedTests/singlePhaseWell/compressible_single_phase_wells_1d.xml index 89fe51caa4a..c8ab26d4f5b 100644 --- a/src/coreComponents/physicsSolvers/Wells/integratedTests/singlePhaseWell/compressible_single_phase_wells_1d.xml +++ b/src/coreComponents/physicsSolvers/Wells/integratedTests/singlePhaseWell/compressible_single_phase_wells_1d.xml @@ -116,7 +116,7 @@ + target="/Outputs/restartOutput"/> @@ -206,7 +206,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/Wells/integratedTests/singlePhaseWell/incompressible_single_phase_wells_2d.xml b/src/coreComponents/physicsSolvers/Wells/integratedTests/singlePhaseWell/incompressible_single_phase_wells_2d.xml index a4a68d8087a..747834e3793 100644 --- a/src/coreComponents/physicsSolvers/Wells/integratedTests/singlePhaseWell/incompressible_single_phase_wells_2d.xml +++ b/src/coreComponents/physicsSolvers/Wells/integratedTests/singlePhaseWell/incompressible_single_phase_wells_2d.xml @@ -137,7 +137,7 @@ + target="/Outputs/restartOutput"/> @@ -230,7 +230,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/Wells/integratedTests/singlePhaseWell/staircase_single_phase_wells_3d.xml b/src/coreComponents/physicsSolvers/Wells/integratedTests/singlePhaseWell/staircase_single_phase_wells_3d.xml index efbc1b2a151..e6ad56adbc4 100644 --- a/src/coreComponents/physicsSolvers/Wells/integratedTests/singlePhaseWell/staircase_single_phase_wells_3d.xml +++ b/src/coreComponents/physicsSolvers/Wells/integratedTests/singlePhaseWell/staircase_single_phase_wells_3d.xml @@ -100,7 +100,7 @@ + target="/Outputs/restartOutput"/> @@ -183,6 +183,6 @@ - + diff --git a/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/SSLE-QS-beamBending.xml b/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/SSLE-QS-beamBending.xml index 91a38d5b7c9..8e3bbdb4d9b 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/SSLE-QS-beamBending.xml +++ b/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/SSLE-QS-beamBending.xml @@ -49,7 +49,7 @@ @@ -126,7 +126,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/SSLE-sedov-cuda.xml b/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/SSLE-sedov-cuda.xml index 8fa5bfb9f8c..6b74fcdfc80 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/SSLE-sedov-cuda.xml +++ b/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/SSLE-sedov-cuda.xml @@ -31,7 +31,7 @@ + target="/Outputs/restartOutput"/> @@ -84,7 +84,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/sedov_base.xml b/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/sedov_base.xml index 5009b82ccc0..e3555426acd 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/sedov_base.xml +++ b/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/sedov_base.xml @@ -29,7 +29,7 @@ + target="/Outputs/restartOutput"/> @@ -109,7 +109,7 @@ plotFileRoot="plot" slaveDirectory="sub" /> - + diff --git a/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/solidMechBlock.xml b/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/solidMechBlock.xml index 4a27c3cdb0e..63554c99f6f 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/solidMechBlock.xml +++ b/src/coreComponents/physicsSolvers/solidMechanics/integratedTests/solidMechBlock.xml @@ -49,7 +49,7 @@ + target="/Outputs/restartOutput"/> @@ -130,7 +130,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/DryFrac_StaticPenny_PrismElem.xml b/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/DryFrac_StaticPenny_PrismElem.xml index 80a14fd2d13..de3055c1235 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/DryFrac_StaticPenny_PrismElem.xml +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/DryFrac_StaticPenny_PrismElem.xml @@ -65,7 +65,7 @@ + target="/Outputs/restartOutput"/> @@ -163,7 +163,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/DryFrac_ThreeNodesPinched_HorizontalFrac.xml b/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/DryFrac_ThreeNodesPinched_HorizontalFrac.xml index 40d0e57b47a..f92c46d152c 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/DryFrac_ThreeNodesPinched_HorizontalFrac.xml +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/DryFrac_ThreeNodesPinched_HorizontalFrac.xml @@ -65,7 +65,7 @@ + target="/Outputs/restartOutput"/> @@ -164,7 +164,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/DryFrac_ThreeNodesPinched_SlantFrac.xml b/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/DryFrac_ThreeNodesPinched_SlantFrac.xml index d68ff810fa9..2b43786fdc2 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/DryFrac_ThreeNodesPinched_SlantFrac.xml +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/DryFrac_ThreeNodesPinched_SlantFrac.xml @@ -65,7 +65,7 @@ + target="/Outputs/restartOutput"/> @@ -164,7 +164,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/SurfaceGenerator.xml b/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/SurfaceGenerator.xml index 581694b5279..a82af7f241d 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/SurfaceGenerator.xml +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/integratedTests/SurfaceGenerator.xml @@ -75,7 +75,7 @@ + target="/Outputs/restartOutput"/> @@ -177,7 +177,7 @@ - + diff --git a/src/coreComponents/physicsSolvers/unitTests/testReservoirCompositionalMultiphaseMSWells.xml b/src/coreComponents/physicsSolvers/unitTests/testReservoirCompositionalMultiphaseMSWells.xml index 703b3497853..860c82fcc20 100644 --- a/src/coreComponents/physicsSolvers/unitTests/testReservoirCompositionalMultiphaseMSWells.xml +++ b/src/coreComponents/physicsSolvers/unitTests/testReservoirCompositionalMultiphaseMSWells.xml @@ -118,7 +118,7 @@ @@ -255,7 +255,7 @@ - + diff --git a/src/coreComponents/python/modules/pygeos_package/pygeos/tests/generate_test_xml.py b/src/coreComponents/python/modules/pygeos_package/pygeos/tests/generate_test_xml.py index e0cb2bf838a..68db0a471a2 100644 --- a/src/coreComponents/python/modules/pygeos_package/pygeos/tests/generate_test_xml.py +++ b/src/coreComponents/python/modules/pygeos_package/pygeos/tests/generate_test_xml.py @@ -87,7 +87,7 @@ def generate_test_xml_files(root_dir): + target="/Outputs/restartOutput"/> @@ -122,7 +122,7 @@ def generate_test_xml_files(root_dir): - + """ diff --git a/src/docs/sphinx/tutorials/singlePhaseFlowExternalMesh/Tutorial.rst.depricate b/src/docs/sphinx/tutorials/singlePhaseFlowExternalMesh/Tutorial.rst.depricate index 97908e52e5f..226a7f80656 100644 --- a/src/docs/sphinx/tutorials/singlePhaseFlowExternalMesh/Tutorial.rst.depricate +++ b/src/docs/sphinx/tutorials/singlePhaseFlowExternalMesh/Tutorial.rst.depricate @@ -119,7 +119,7 @@ Three controls are in place: @@ -262,7 +262,7 @@ In our case, the first lines are: Adding Event: PeriodicEvent, outputs Adding Event: PeriodicEvent, restarts Adding Output: Silo, siloWellPump - Adding Output: Restart, sidreRestart + Adding Output: Restart, restartOutput Adding Object ElementRegion named Domain This indicates initialization of GEOSX. @@ -430,7 +430,7 @@ Three controls are in place: @@ -576,7 +576,7 @@ In our case, the first lines are: Adding Event: PeriodicEvent, outputs Adding Event: PeriodicEvent, restarts Adding Output: Silo, siloWellPump - Adding Output: Restart, sidreRestart + Adding Output: Restart, restartOutput Adding Object ElementRegion named Domain 0 >>> ********************************************************************** 0 >>> PAMELA Library Import tool From 3ca4690e740010902b0da0ed2456301bfc51d917 Mon Sep 17 00:00:00 2001 From: Benjamin Curtice Corbett Date: Thu, 7 Nov 2019 09:10:44 -0800 Subject: [PATCH 5/5] Submodule update. --- integratedTests | 2 +- src/coreComponents/cxx-utilities | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integratedTests b/integratedTests index 3e2f3ae5d88..0dddb9e1f12 160000 --- a/integratedTests +++ b/integratedTests @@ -1 +1 @@ -Subproject commit 3e2f3ae5d88ce91bc91b68ae25efa85b85dfc3f6 +Subproject commit 0dddb9e1f121712a3d1cb5251ab557c299e63498 diff --git a/src/coreComponents/cxx-utilities b/src/coreComponents/cxx-utilities index 2c2b0fe57bd..1fa348ecb9e 160000 --- a/src/coreComponents/cxx-utilities +++ b/src/coreComponents/cxx-utilities @@ -1 +1 @@ -Subproject commit 2c2b0fe57bd8911163e1b2c951d740e0966bf47b +Subproject commit 1fa348ecb9efcd11a76c67d2de24907665023ead