21 #ifndef fiber_element_pair_topology_hpp
22 #define fiber_element_pair_topology_hpp
24 #include "../common/common.hpp"
26 #include "../common/armadillo_fwd.hpp"
29 #include <boost/tuple/tuple_comparison.hpp>
46 enum Type { Disjoint, SharedVertex, SharedEdge, Coincident };
71 using boost::tuples::make_tuple;
91 return !operator==(other);
97 dest << obj.type <<
" "
98 << (int)obj.testVertexCount <<
" "
99 << (
int)obj.trialVertexCount <<
" "
100 << (int)obj.testSharedVertex0 <<
" "
101 << (
int)obj.testSharedVertex1 <<
" "
102 << (int)obj.trialSharedVertex0 <<
" "
103 << (
int)obj.trialSharedVertex1;
108 inline ElementPairTopology determineElementPairTopologyIn3D(
109 const arma::Col<int>& testElementCornerIndices,
110 const arma::Col<int>& trialElementCornerIndices)
112 ElementPairTopology topology;
116 const int MIN_VERTEX_COUNT = 3;
118 const int MAX_VERTEX_COUNT = 4;
120 assert(MIN_VERTEX_COUNT <= topology.testVertexCount &&
121 topology.testVertexCount <= MAX_VERTEX_COUNT);
122 topology.trialVertexCount = trialElementCornerIndices.n_rows;
123 assert(MIN_VERTEX_COUNT <= topology.trialVertexCount &&
124 topology.trialVertexCount <= MAX_VERTEX_COUNT);
127 int testSharedVertices[MAX_VERTEX_COUNT];
128 int trialSharedVertices[MAX_VERTEX_COUNT];
131 for (
int trialV = 0; trialV < topology.trialVertexCount; ++trialV)
132 for (
int testV = 0; testV < topology.testVertexCount; ++testV)
133 if (testElementCornerIndices(testV) ==
134 trialElementCornerIndices(trialV))
136 testSharedVertices[hits] = testV;
137 trialSharedVertices[hits] = trialV;
144 topology.type = ElementPairTopology::Disjoint;
148 topology.type = ElementPairTopology::SharedVertex;
149 topology.testSharedVertex0 = testSharedVertices[0];
150 topology.trialSharedVertex0 = trialSharedVertices[0];
154 topology.type = ElementPairTopology::SharedEdge;
155 topology.testSharedVertex0 = testSharedVertices[0];
156 topology.testSharedVertex1 = testSharedVertices[1];
157 topology.trialSharedVertex0 = trialSharedVertices[0];
158 topology.trialSharedVertex1 = trialSharedVertices[1];
161 else if (hits == topology.testVertexCount &&
162 hits == topology.trialVertexCount)
166 for (
int i = 0; i < hits; ++i)
167 assert(testSharedVertices[i] == trialSharedVertices[i]);
168 topology.type = ElementPairTopology::Coincident;
171 throw std::runtime_error(
172 "Standard3DIntegrationManager::"
173 "selectTestKernelTrialQuadratureRules() :"
174 "Invalid element configuration");
unsigned char testVertexCount
Number of vertices of the test element.
Definition: element_pair_topology.hpp:50
Configuration of a pair of elements.
Definition: element_pair_topology.hpp:35
unsigned char trialVertexCount
Number of vertices of the trial element.
Definition: element_pair_topology.hpp:52
Type
Location of one element with respect to the other.
Definition: element_pair_topology.hpp:46
ElementPairTopology()
Constructor.
Definition: element_pair_topology.hpp:38
signed char testSharedVertex1
Index of the second vertex of the test element that is shared with the trial element, or -1 if at most one vertex is shared.
Definition: element_pair_topology.hpp:60
Type type
Location of one element with respect to the other.
Definition: element_pair_topology.hpp:48
signed char trialSharedVertex1
Index of the second vertex of the trial element that is shared with the test element, or -1 if at most one vertex is shared.
Definition: element_pair_topology.hpp:68
signed char testSharedVertex0
Index of the first vertex of the test element that is shared with the trial element, or -1 if no vertices are shared.
Definition: element_pair_topology.hpp:56
signed char trialSharedVertex0
Index of the first vertex of the trial element that is shared with the test element, or -1 if no vertices are shared.
Definition: element_pair_topology.hpp:64