30 #define KRATOS_SINGLE_VARIABLE_TYPES bool, int, double, unsigned int
31 #define KRATOS_BOUNDED_VECTOR_VARIABLE_TYPES array_1d<double,3>, array_1d<double,4>, array_1d<double,6>, array_1d<double,9>
32 #define KRATOS_UNBOUNDED_VECTOR_VARIABLE_TYPES Vector, Matrix
43 template <
class T,
class... Ts>
44 struct is_any : std::integral_constant<bool, (std::is_same<T, Ts>::value || ...)> {};
50 template<
class TVarType,
class TReturnType>
using EnalbeIfSingle =
typename std::enable_if<is_kratos_single_variable<TVarType>::value, TReturnType>
::type;
51 template<
class TVarType,
class TReturnType>
using EnalbeIfBoundedVector =
typename std::enable_if<is_kratos_bounded_vector_variable<TVarType>::value, TReturnType>
::type;
52 template<
class TVarType,
class TReturnType>
using EnalbeIfUnbounedVector =
typename std::enable_if<is_kratos_unbounded_vector_variable<TVarType>::value, TReturnType>
::type;
79 template<
class TVarType>
82 return rVar1 == rVar2;
85 template<
class TVarType>
88 for(
typename TVarType::array_type::size_type
i = 0; i < std::tuple_size<typename TVarType::array_type>::value;
i++) {
89 if(rVar1[
i] != rVar2[
i])
return false;
94 template<
class TVarType,
class TContainerType>
97 const TContainerType & rContainer,
98 const TVarType & rVariable)
102 std::vector<int> indices;
104 for(
auto& entity : rContainer) {
105 indices.push_back(entity.Id());
116 template<
class TContainerType,
class TVarType>
119 const TContainerType & rContainer,
120 const TVarType & rVariable,
126 bool val_error_detected =
false;
128 std::stringstream error_stream;
131 auto data_proxy = rPointerCommunicator.
Apply(
133 return gp->GetValue(rVariable);
138 for(
auto& entity : rContainer) {
139 auto& gp = gp_map[entity.Id()];
141 if(!
InteralCmpEq(entity.GetValue(rVariable),data_proxy.Get(gp))) {
142 std::cout << r_default_comm.
Rank() <<
" Inconsistent variable value for Id: " << entity.Id() <<
" Expected: " << entity.GetValue(rVariable) <<
" Obtained " << data_proxy.Get(gp) << std::endl;
143 val_error_detected =
true;
147 if(val_error_detected) {
148 error_stream <<
"Value error(s) found" << std::endl;
151 if(error_stream.rdbuf()->in_avail())
159 template<
class TVarType>
162 const TVarType & rVariable)
166 std::vector<int> indices;
171 indices.push_back(
node.Id());
182 template<
class TVarType>
185 const TVarType & rVariable,
191 bool val_error_detected =
false;
192 bool fix_error_detected =
false;
194 std::stringstream error_stream;
197 auto data_proxy = rPointerCommunicator.
Apply(
199 return {gp->FastGetSolutionStepValue(rVariable),gp->IsFixed(rVariable)};
205 auto& gp = gp_map[
node.Id()];
208 if(!
InteralCmpEq(
node.FastGetSolutionStepValue(rVariable),data_proxy.Get(gp).first)) {
209 std::cout << r_default_comm.
Rank() <<
" Inconsistent variable value for Id: " <<
node.Id() <<
" Expected: " <<
node.FastGetSolutionStepValue(rVariable) <<
" Obtained " << data_proxy.Get(gp).first << std::endl;
210 val_error_detected =
true;
216 auto& gp = gp_map[
node.Id()];
219 if(
node.IsFixed(rVariable) != data_proxy.Get(gp).second) {
220 std::cout << r_default_comm.
Rank() <<
" Inconsistent variable Fix for Id: " <<
node.Id() <<
" Expected: " <<
node.IsFixed(rVariable) <<
" Obtained " << data_proxy.Get(gp).second << std::endl;
221 fix_error_detected =
true;
225 if(val_error_detected) {
226 error_stream <<
"Value error(s) found" << std::endl;
229 if(fix_error_detected) {
230 error_stream <<
"Fixity error(s) found" << std::endl;
233 if(error_stream.rdbuf()->in_avail())
Serial (do-nothing) version of a wrapper class for MPI communication.
Definition: data_communicator.h:318
virtual int Rank() const
Get the parallel rank for this DataCommunicator.
Definition: data_communicator.h:587
A template class for handling communication related to global pointers.
Definition: pointer_communicator.h:178
ResultsProxy< TPointerDataType, TFunctorType > Apply(TFunctorType &&UserFunctor)
Applies a user-provided function to the global pointers and return a proxy to the results.
Definition: pointer_communicator.h:266
This class is a wrapper for a pointer to a data that is located in a different rank.
Definition: global_pointer.h:44
static std::unordered_map< int, GlobalPointer< typename TContainerType::value_type > > RetrieveGlobalIndexedPointersMap(const TContainerType &rContainer, const std::vector< int > &rIdList, const DataCommunicator &rDataCommunicator)
Retrieves a map of global pointers corresponding to the given entity ids, where the global pointers p...
Definition: global_pointer_utilities.h:95
static GlobalPointersVector< typename TContainerType::value_type > RetrieveGlobalIndexedPointers(const TContainerType &rContainer, const std::vector< int > &rIdList, const DataCommunicator &rDataCommunicator)
Retrieve global indexed pointers from container and data communicator.
Definition: global_pointer_utilities.h:329
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
Definition: debug_utilities.h:36
typename std::enable_if< is_kratos_bounded_vector_variable< TVarType >::value, TReturnType >::type EnalbeIfBoundedVector
Definition: debug_utilities.h:51
static void CheckNonHistoricalVariable(ModelPart &rModelPart, const TContainerType &rContainer, const TVarType &rVariable)
Definition: debug_utilities.h:95
MpiDebugUtilities()
Definition: debug_utilities.h:41
static EnalbeIfSingle< TVarType, bool > InteralCmpEq(const TVarType &rVar1, const TVarType &rVar2)
Definition: debug_utilities.h:80
static void CheckHistoricalVariable(ModelPart &rModelPart, const TVarType &rVariable)
Definition: debug_utilities.h:160
typename std::enable_if< is_kratos_single_variable< TVarType >::value, TReturnType >::type EnalbeIfSingle
Definition: debug_utilities.h:50
typename std::enable_if< is_kratos_unbounded_vector_variable< TVarType >::value, TReturnType >::type EnalbeIfUnbounedVector
Definition: debug_utilities.h:52
KRATOS_CLASS_POINTER_DEFINITION(MpiDebugUtilities)
static void CheckHistoricalVariable(ModelPart &rModelPart, const TVarType &rVariable, GlobalPointerCommunicator< Node > &rPointerCommunicator, std::unordered_map< int, GlobalPointer< Node >> &gp_map)
Definition: debug_utilities.h:183
static void CheckNonHistoricalVariable(ModelPart &rModelPart, const TContainerType &rContainer, const TVarType &rVariable, GlobalPointerCommunicator< typename TContainerType::data_type > &rPointerCommunicator, std::unordered_map< int, GlobalPointer< typename TContainerType::data_type >> &gp_map)
Definition: debug_utilities.h:117
static EnalbeIfBoundedVector< TVarType, bool > InteralCmpEq(const TVarType &rVar1, const TVarType &rVar2)
Definition: debug_utilities.h:86
static DataCommunicator & GetDefaultDataCommunicator()
Retrieve the default DataCommunicator instance.
Definition: parallel_environment.cpp:32
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
type
Definition: generate_gid_list_file.py:35
list node_list
Definition: mesh_to_mdpa_converter.py:39
integer i
Definition: TensorModule.f:17
Definition: debug_utilities.h:44
Definition: debug_utilities.h:47
Definition: debug_utilities.h:46
Definition: debug_utilities.h:48
Definition: mesh_converter.cpp:38