MCPcopy Create free account
hub / github.com/IBAMR/IBAMR / init_meter_elements

Function init_meter_elements

src/IB/IBInstrumentPanel.cpp:104–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102static const std::string SILO_PROCESSOR_FILE_POSTFIX = ".silo";
103
104void
105init_meter_elements(boost::multi_array<Point, 2>& X_web,
106 boost::multi_array<Vector, 2>& dA_web,
107 const boost::multi_array<Point, 1>& X_perimeter,
108 const Point& X_centroid)
109{
110#if (NDIM == 2)
111 TBOX_ERROR("no support for 2D flow meters at this time!\n");
112 NULL_USE(X_web);
113 NULL_USE(dA_web);
114 NULL_USE(X_perimeter);
115 NULL_USE(X_centroid);
116#endif
117#if (NDIM == 3)
118#if !defined(NDEBUG)
119 TBOX_ASSERT(X_web.shape()[0] == X_perimeter.shape()[0]);
120 TBOX_ASSERT(dA_web.shape()[0] == X_perimeter.shape()[0]);
121#endif
122 const int num_perimeter_nodes = static_cast<int>(X_web.shape()[0]);
123 const int num_web_nodes = static_cast<int>(X_web.shape()[1]);
124 for (int m = 0; m < num_perimeter_nodes; ++m)
125 {
126 const Point& X_perimeter0(X_perimeter[m]);
127 const Vector dX0((X_centroid - X_perimeter0) / static_cast<double>(num_web_nodes));
128
129 const Point& X_perimeter1(X_perimeter[(m + 1) % num_perimeter_nodes]);
130 const Vector dX1((X_centroid - X_perimeter1) / static_cast<double>(num_web_nodes));
131
132 // Away from the center of the web, each web patch is a planar
133 // quadrilateral. At the web centroid, the quadrilateral is degenerate,
134 // i.e., it is a triangle.
135 for (int n = 0; n < num_web_nodes; ++n)
136 {
137 // Compute the four vertices of the quadrilateral web patch.
138 //
139 // Note that here the vertices are placed in "standard" (i.e.,
140 // "counter-clockwise") orientation.
141 const Point X0(X_perimeter0 + static_cast<double>(n) * dX0);
142 const Point X1(X_perimeter1 + static_cast<double>(n) * dX1);
143 const Point X2(X_perimeter1 + static_cast<double>(n + 1) * dX1);
144 const Point X3(X_perimeter0 + static_cast<double>(n + 1) * dX0);
145
146 // Compute the midpoints of the edges of the quadrilateral.
147 const Point X01(0.5 * (X0 + X1));
148 const Point X12(0.5 * (X1 + X2));
149 const Point X23(0.5 * (X2 + X3));
150 const Point X30(0.5 * (X3 + X0));
151
152 // Construct a parametric representation of the lines connecting the
153 // midpoints of the edges.
154 const Point& l0 = X01;
155 const Vector d0 = X23 - X01;
156
157 const Point& l1 = X12;
158 const Vector d1 = X30 - X12;
159
160 // Compute the centroid as the intersection of the lines connecting
161 // the midpoints of the edges.

Callers 1

Calls 3

crossMethod · 0.80
shapeMethod · 0.45
dotMethod · 0.45

Tested by

no test coverage detected