Skip to content

Commit 0bd711e

Browse files
committed
Move methods to source file
1 parent 15114f5 commit 0bd711e

2 files changed

Lines changed: 63 additions & 63 deletions

File tree

applications/CoSimulationApplication/custom_processes/data_transfer_3D_1D_process.cpp

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,69 @@ using DistanceIterator = DistanceVector::iterator;
3434
using BucketType = Bucket<3ul, PointType, PointVector, PointTypePointer, PointIterator, DistanceIterator>; \
3535
using KDTree = Tree<KDTreePartition<BucketType>>;
3636

37+
/**
38+
* @brief This method determines the 1D model part
39+
* @param rFirstModelPart The first ModelPart
40+
* @param rSecondModelPart The second ModelPart
41+
* @return The 1D model part
42+
*/
43+
ModelPart& Determine1DModelPart(ModelPart& rFirstModelPart, ModelPart& rSecondModelPart)
44+
{
45+
// In MPI could be a bit troublesome
46+
if (rFirstModelPart.IsDistributed()) {
47+
KRATOS_ERROR << "Not compatible with MPI" << std::endl;
48+
} else { // In serial we just check model part has 1D entities (local space)
49+
// Determine if the modelparts have entities
50+
51+
// First model part
52+
if (rFirstModelPart.NumberOfElements() > 0 || rFirstModelPart.NumberOfConditions() > 0 ) {
53+
if (rFirstModelPart.NumberOfConditions() > 0) {
54+
if (rFirstModelPart.ConditionsBegin()->GetGeometry().LocalSpaceDimension() == 1) {
55+
return rFirstModelPart;
56+
}
57+
} else {
58+
if (rFirstModelPart.ElementsBegin()->GetGeometry().LocalSpaceDimension() == 1) {
59+
return rFirstModelPart;
60+
}
61+
}
62+
}
63+
64+
// Second model part
65+
if (rSecondModelPart.NumberOfElements() > 0 || rSecondModelPart.NumberOfConditions() > 0 ) {
66+
if (rSecondModelPart.NumberOfConditions() > 0) {
67+
if (rSecondModelPart.ConditionsBegin()->GetGeometry().LocalSpaceDimension() == 1) {
68+
return rSecondModelPart;
69+
}
70+
} else {
71+
if (rSecondModelPart.ElementsBegin()->GetGeometry().LocalSpaceDimension() == 1) {
72+
return rSecondModelPart;
73+
}
74+
}
75+
}
76+
}
77+
78+
KRATOS_ERROR << "Impossible to detect 1D model part" << std::endl;
79+
return rFirstModelPart;
80+
}
81+
82+
/**
83+
* @brief This method determines the 3D model part
84+
* @details The counter part of the previous method
85+
* @param rFirstModelPart The first ModelPart
86+
* @param rSecondModelPart The second ModelPart
87+
* @return The 3D model part
88+
*/
89+
ModelPart& Determine3DModelPart(ModelPart& rFirstModelPart, ModelPart& rSecondModelPart)
90+
{
91+
// It is the counter part of the previous method
92+
ModelPart* p_1d_model_part = &Determine1DModelPart(rFirstModelPart, rSecondModelPart);
93+
if (p_1d_model_part == &rFirstModelPart) {
94+
return rSecondModelPart;
95+
} else {
96+
return rFirstModelPart;
97+
}
98+
}
99+
37100
/***********************************************************************************/
38101
/***********************************************************************************/
39102

applications/CoSimulationApplication/custom_processes/data_transfer_3D_1D_process.h

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -35,69 +35,6 @@ namespace Kratos
3535
///@name Functions
3636
///@{
3737

38-
/**
39-
* @brief This method determines the 1D model part
40-
* @param rFirstModelPart The first ModelPart
41-
* @param rSecondModelPart The second ModelPart
42-
* @return The 1D model part
43-
*/
44-
ModelPart& Determine1DModelPart(ModelPart& rFirstModelPart, ModelPart& rSecondModelPart)
45-
{
46-
// In MPI could be a bit troublesome
47-
if (rFirstModelPart.IsDistributed()) {
48-
KRATOS_ERROR << "Not compatible with MPI" << std::endl;
49-
} else { // In serial we just check model part has 1D entities (local space)
50-
// Determine if the modelparts have entities
51-
52-
// First model part
53-
if (rFirstModelPart.NumberOfElements() > 0 || rFirstModelPart.NumberOfConditions() > 0 ) {
54-
if (rFirstModelPart.NumberOfConditions() > 0) {
55-
if (rFirstModelPart.ConditionsBegin()->GetGeometry().LocalSpaceDimension() == 1) {
56-
return rFirstModelPart;
57-
}
58-
} else {
59-
if (rFirstModelPart.ElementsBegin()->GetGeometry().LocalSpaceDimension() == 1) {
60-
return rFirstModelPart;
61-
}
62-
}
63-
}
64-
65-
// Second model part
66-
if (rSecondModelPart.NumberOfElements() > 0 || rSecondModelPart.NumberOfConditions() > 0 ) {
67-
if (rSecondModelPart.NumberOfConditions() > 0) {
68-
if (rSecondModelPart.ConditionsBegin()->GetGeometry().LocalSpaceDimension() == 1) {
69-
return rSecondModelPart;
70-
}
71-
} else {
72-
if (rSecondModelPart.ElementsBegin()->GetGeometry().LocalSpaceDimension() == 1) {
73-
return rSecondModelPart;
74-
}
75-
}
76-
}
77-
}
78-
79-
KRATOS_ERROR << "Impossible to detect 1D model part" << std::endl;
80-
return rFirstModelPart;
81-
}
82-
83-
/**
84-
* @brief This method determines the 3D model part
85-
* @details The counter part of the previous method
86-
* @param rFirstModelPart The first ModelPart
87-
* @param rSecondModelPart The second ModelPart
88-
* @return The 3D model part
89-
*/
90-
ModelPart& Determine3DModelPart(ModelPart& rFirstModelPart, ModelPart& rSecondModelPart)
91-
{
92-
// It is the counter part of the previous method
93-
ModelPart* p_1d_model_part = &Determine1DModelPart(rFirstModelPart, rSecondModelPart);
94-
if (p_1d_model_part == &rFirstModelPart) {
95-
return rSecondModelPart;
96-
} else {
97-
return rFirstModelPart;
98-
}
99-
}
100-
10138
///@}
10239
///@name Kratos Classes
10340
///@{

0 commit comments

Comments
 (0)