@@ -34,6 +34,69 @@ using DistanceIterator = DistanceVector::iterator;
3434using BucketType = Bucket<3ul , PointType, PointVector, PointTypePointer, PointIterator, DistanceIterator>; \
3535using 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
0 commit comments