16 #include <unordered_set>
57 namespace NodalInterpolationFunctions
66 std::unordered_set<std::string>& rVariableList
100 mpOriginCond(nullptr)
105 mpOriginCond(nullptr)
116 Condition::Pointer pCond
125 mpOriginCond(
rhs.mpOriginCond)
161 mpOriginCond = pCond;
170 KRATOS_DEBUG_ERROR_IF(mpOriginCond.get() ==
nullptr) <<
"Condition no initialized in the PointBoundary class" << std::endl;
181 auto aux_coord = Kratos::make_shared<array_1d<double, 3>>(this->
Coordinates());
182 KRATOS_ERROR_IF(!aux_coord) <<
"Coordinates no initialized in the PointBoundary class" << std::endl;
183 KRATOS_ERROR_IF(mpOriginCond.get() ==
nullptr) <<
"Condition no initialized in the PointBoundary class" << std::endl;
199 Condition::Pointer mpOriginCond;
211 template<SizeType TDim>
287 void Execute()
override;
292 const Parameters GetDefaultParameters()
const override;
309 std::string
Info()
const override
311 return "NodalValuesInterpolationProcess";
338 std::unordered_set<std::string> mListVariables;
355 if(Str ==
"Lagrangian" || Str ==
"LAGRANGIAN")
357 else if(Str ==
"Eulerian" || Str ==
"EULERIAN")
359 else if(Str ==
"ALE")
371 template<
class TEntity>
373 NodeType::Pointer pNode,
374 const typename TEntity::Pointer& pEntity,
375 const Vector& rShapeFunctions
380 const SizeType number_of_nodes = r_geometry.size();
383 double aux_coeff = 0.0;
385 aux_coeff += rShapeFunctions[
i];
387 for (
auto& r_variable_name : mListVariables) {
388 if (KratosComponents<Variable<double>>::
Has(r_variable_name)) {
389 const Variable<double>& r_variable = KratosComponents<Variable<double>>::Get(r_variable_name);
390 if (std::abs(aux_coeff) > std::numeric_limits<double>::epsilon()) {
391 aux_coeff = 1.0/aux_coeff;
392 double aux_value = 0.0;
394 if (r_geometry[
i].
Has(r_variable)) {
395 aux_value += rShapeFunctions[
i] * r_geometry[
i].GetValue(r_variable);
398 pNode->SetValue(r_variable, aux_coeff * aux_value);
400 }
else if (KratosComponents<Variable<array_1d<double, 3>>>::
Has(r_variable_name)) {
401 const Variable<array_1d<double, 3>>& r_variable = KratosComponents<Variable<array_1d<double, 3>>>::Get(r_variable_name);
402 if (std::abs(aux_coeff) > std::numeric_limits<double>::epsilon()) {
403 aux_coeff = 1.0/aux_coeff;
404 array_1d<double, 3> aux_value =
ZeroVector(3);
406 if (r_geometry[
i].
Has(r_variable)) {
407 aux_value += rShapeFunctions[
i] * r_geometry[
i].GetValue(r_variable);
410 pNode->SetValue(r_variable, aux_coeff * aux_value);
412 }
else if (KratosComponents<Variable<Vector>>::
Has(r_variable_name)) {
413 const Variable<Vector>& r_variable = KratosComponents<Variable<Vector>>::Get(r_variable_name);
414 if (std::abs(aux_coeff) > std::numeric_limits<double>::epsilon()) {
415 aux_coeff = 1.0/aux_coeff;
418 if (r_geometry[
i].
Has(r_variable)) {
419 aux_value += rShapeFunctions[
i] * r_geometry[
i].GetValue(r_variable);
422 pNode->SetValue(r_variable, aux_coeff * aux_value);
424 }
else if (KratosComponents<Variable<Matrix>>::
Has(r_variable_name)) {
425 const Variable<Matrix>& r_variable = KratosComponents<Variable<Matrix>>::Get(r_variable_name);
426 if (std::abs(aux_coeff) > std::numeric_limits<double>::epsilon()) {
427 aux_coeff = 1.0/aux_coeff;
430 if (r_geometry[
i].
Has(r_variable)) {
431 aux_value += rShapeFunctions[
i] * r_geometry[
i].GetValue(r_variable);
434 pNode->SetValue(r_variable, aux_coeff * aux_value);
447 template<
class TEntity>
448 void CalculateStepData(
449 NodeType::Pointer pNode,
450 const typename TEntity::Pointer& pEntity,
451 const Vector& rShapeFunctions,
456 double* step_data = pNode->SolutionStepData().Data(Step);
457 for (
int j = 0;
j < mThisParameters[
"step_data_size"].
GetInt(); ++
j)
462 const SizeType number_of_nodes = geom.size();
464 const double* nodal_data = geom[
i].SolutionStepData().Data(Step);
466 for (
int j = 0;
j < mThisParameters[
"step_data_size"].
GetInt(); ++
j) {
467 step_data[
j] += rShapeFunctions[
i] * nodal_data[
j];
476 void GenerateBoundary(
const std::string& rAuxiliarNameModelPart);
483 void GenerateBoundaryFromElements(
484 ModelPart& rModelPart,
485 const std::string& rAuxiliarNameModelPart
493 void ExtrapolateValues(
494 const std::string& rAuxiliarNameModelPart,
495 std::vector<NodeType::Pointer>& rToExtrapolateNodes
502 void ComputeNormalSkin(ModelPart& rModelPart);
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Short class definition.
Definition: bucket.h:57
Geometry base class.
Definition: geometry.h:71
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::ConditionsContainerType ConditionsContainerType
Condintions container. A vector set of Conditions with their Id's as key.
Definition: model_part.h:183
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
This utilitiy has as objective to interpolate the values inside elements (and conditions?...
Definition: nodal_values_interpolation_process.h:214
std::vector< PointTypePointer > PointVector
Definition: nodal_values_interpolation_process.h:231
Node NodeType
Definition: nodal_values_interpolation_process.h:223
FrameworkEulerLagrange
This enums allows to differentiate the working framework.
Definition: nodal_values_interpolation_process.h:250
PointVector::iterator PointIterator
Definition: nodal_values_interpolation_process.h:232
ModelPart::ElementsContainerType ElementsArrayType
Definition: nodal_values_interpolation_process.h:221
KRATOS_CLASS_POINTER_DEFINITION(NodalValuesInterpolationProcess)
Pointer definition of NodalValuesInterpolationProcess.
PointBoundary PointBoundaryType
Definition: nodal_values_interpolation_process.h:229
Tree< KDTreePartition< BucketType > > KDTreeType
Definition: nodal_values_interpolation_process.h:238
~NodalValuesInterpolationProcess() override=default
Destructor.
std::vector< double > DistanceVector
Definition: nodal_values_interpolation_process.h:233
PointBoundaryType::Pointer PointTypePointer
Definition: nodal_values_interpolation_process.h:230
ModelPart::NodesContainerType NodesArrayType
Definition: nodal_values_interpolation_process.h:220
PointType::CoordinatesArrayType CoordinatesArrayType
Definition: nodal_values_interpolation_process.h:226
std::string Info() const override
Turn back information as a string.
Definition: nodal_values_interpolation_process.h:309
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: nodal_values_interpolation_process.h:317
void operator()()
Definition: nodal_values_interpolation_process.h:275
Point PointType
Definition: nodal_values_interpolation_process.h:225
Bucket< 3ul, PointBoundaryType, PointVector, PointTypePointer, PointIterator, DistanceIterator > BucketType
Definition: nodal_values_interpolation_process.h:237
Geometry< NodeType > GeometryType
Definition: nodal_values_interpolation_process.h:224
DistanceVector::iterator DistanceIterator
Definition: nodal_values_interpolation_process.h:234
ModelPart::ConditionsContainerType ConditionsArrayType
Definition: nodal_values_interpolation_process.h:222
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
int GetInt() const
This method returns the integer contained in the current Parameter.
Definition: kratos_parameters.cpp:666
Custom Point container to be used to look in the boundary skin.
Definition: nodal_values_interpolation_process.h:83
PointBoundary(const array_1d< double, 3 > &Coords, Condition::Pointer pCond)
Definition: nodal_values_interpolation_process.h:114
void Check()
This method checks everything is right.
Definition: nodal_values_interpolation_process.h:177
PointBoundary(const array_1d< double, 3 > &Coords)
Definition: nodal_values_interpolation_process.h:103
BaseType GetPoint()
Returns the point.
Definition: nodal_values_interpolation_process.h:140
void SetCondition(Condition::Pointer pCond)
Sets the condition associated to the point.
Definition: nodal_values_interpolation_process.h:159
Condition::Pointer GetCondition()
Returns the condition associated to the point.
Definition: nodal_values_interpolation_process.h:168
void SetPoint(const BaseType Point)
Set the point.
Definition: nodal_values_interpolation_process.h:150
PointBoundary(Condition::Pointer pCond)
Definition: nodal_values_interpolation_process.h:108
~PointBoundary() override=default
Destructor.
KRATOS_CLASS_POINTER_DEFINITION(PointBoundary)
Counted pointer of PointBoundary.
PointBoundary()
Default constructors.
Definition: nodal_values_interpolation_process.h:98
PointBoundary(const PointBoundary &rhs)
Copy constructor (not really required)
Definition: nodal_values_interpolation_process.h:123
void UpdatePoint()
This function updates the database, using as base for the coordinates the condition center.
Definition: nodal_values_interpolation_process.h:191
Point BaseType
Definition: nodal_values_interpolation_process.h:88
Point class.
Definition: point.h:59
CoordinatesArrayType const & Coordinates() const
Definition: point.h:215
Point()
Default constructor.
Definition: point.h:86
The base class for all processes in Kratos.
Definition: process.h:49
A generic tree data structure for spatial partitioning.
Definition: tree.h:190
Short class definition.
Definition: array_1d.h:61
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_DEBUG_ERROR_IF(conditional)
Definition: exception.h:171
#define KRATOS_API(...)
Definition: kratos_export_api.h:40
bool Has(const std::string &ModelerName)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:24
void GetListNonHistoricalVariables(const ModelPart &rModelPart, std::unordered_set< std::string > &rVariableList)
This methoid creates the list of non-historical variables fro nodal interpolation.
Definition: nodal_values_interpolation_process.cpp:30
Parameters GetValue(Parameters &rParameters, const std::string &rEntry)
Definition: add_kratos_parameters_to_python.cpp:53
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
Internals::Matrix< double, AMatrix::dynamic, AMatrix::dynamic > Matrix
Definition: amatrix_interface.h:470
FrameworkEulerLagrange
This enums allows to differentiate the working framework.
Definition: meshing_application.h:66
Geometry< Node > GeometryType
The definition of the geometry.
Definition: mortar_classes.h:37
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
rhs
Definition: generate_frictional_mortar_condition.py:297
int j
Definition: quadrature.py:648
integer i
Definition: TensorModule.f:17