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 f985b7d4e46..0dddb9e1f12 160000
--- a/integratedTests
+++ b/integratedTests
@@ -1 +1 @@
-Subproject commit f985b7d4e46a20ed9e579db4eed90dbfb0e062a7
+Subproject commit 0dddb9e1f121712a3d1cb5251ab557c299e63498
diff --git a/src/coreComponents/codingUtilities/GeosxTraits.hpp b/src/coreComponents/codingUtilities/GeosxTraits.hpp
index 3e646bfdf28..b687bfaea42 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 INDEX_TYPE >
-constexpr bool is_array< LvArray::Array > = 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 > : 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 > : is_packable {};
+template< typename T >
+constexpr bool has_data_method = internal::has_data_method< T >::value;
-template
-struct is_packable_array< LvArray::ArraySlice > : 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::isArray< T >;
-};
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/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..4b1bfc1cf5a 100644
--- a/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp
+++ b/src/coreComponents/codingUtilities/tests/testGeosxTraits.cpp
@@ -12,114 +12,215 @@
* ------------------------------------------------------------------------------------------------------------
*/
-#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>, "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