ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
eb_::EBToPVD Class Reference

#include <ERF_EBToPVD.H>

Collaboration diagram for eb_::EBToPVD:

Public Member Functions

 EBToPVD ()=default
 
void EBToPolygon (const Real *problo, const Real *dx, const Box &bx, Array4< EBCellFlag const > const &flag, Array4< Real const > const &bcent, Array4< Real const > const &apx, Array4< Real const > const &apy, Array4< Real const > const &apz)
 
void WriteEBVTP (int myID, int level) const
 
void EBGridCoverage (int myID, const Real *problo, const Real *dx, const Box &bx, Array4< EBCellFlag const > const &flag)
 

Static Public Member Functions

static void WritePVTP (int nProcs)
 

Private Member Functions

void reorder_polygon (const std::vector< std::array< Real, 3 >> &lpoints, std::array< int, 7 > &lconnect, const std::array< Real, 3 > &lnormal)
 
void print_points (std::ofstream &myfile) const
 
void print_connectivity (std::ofstream &myfile) const
 
void print_grids (std::ofstream &myfile) const
 

Static Private Member Functions

static void calc_hesse (Real &distance, std::array< Real, 3 > &n0, Real &p, const std::array< Real, 3 > &normal, const std::array< Real, 3 > &centroid)
 
static void calc_alpha (std::array< Real, 12 > &alpha, const std::array< Real, 3 > &n0, Real p, const std::array< std::array< Real, 3 >, 8 > &vertex, const Real *dx)
 
static void calc_intersects (int &int_count, std::array< bool, 12 > &intersects_flags, const std::array< Real, 12 > &alpha)
 

Private Attributes

std::vector< std::array< Real, 3 > > m_points
 
std::vector< std::array< int, 7 > > m_connectivity
 
int m_grid {0}
 

Constructor & Destructor Documentation

◆ EBToPVD()

eb_::EBToPVD::EBToPVD ( )
default

Member Function Documentation

◆ calc_alpha()

void eb_::EBToPVD::calc_alpha ( std::array< Real, 12 > &  alpha,
const std::array< Real, 3 > &  n0,
Real  p,
const std::array< std::array< Real, 3 >, 8 > &  vertex,
const Real *  dx 
)
staticprivate
356 {
357  // default (large) value
358  std::fill(alpha.begin(), alpha.end(), 10.0);
359 
360  // Ray-xAxis intersection
361  if(std::abs(n0[0]) > std::numeric_limits<Real>::epsilon()) {
362  alpha[0] = (p - dot_product(n0,vertex[0]))/(n0[0]*dx[0]);
363  alpha[2] = (p - dot_product(n0,vertex[2]))/(n0[0]*dx[0]);
364  alpha[8] = (p - dot_product(n0,vertex[4]))/(n0[0]*dx[0]);
365  alpha[10] = (p - dot_product(n0,vertex[6]))/(n0[0]*dx[0]);
366  }
367 
368  // Ray-yAxis intersection
369  if(std::abs(n0[1]) > std::numeric_limits<Real>::epsilon()) {
370  alpha[1] = (p - dot_product(n0,vertex[1]))/(n0[1]*dx[1]);
371  alpha[3] = (p - dot_product(n0,vertex[0]))/(n0[1]*dx[1]);
372  alpha[9] = (p - dot_product(n0,vertex[5]))/(n0[1]*dx[1]);
373  alpha[11] = (p - dot_product(n0,vertex[4]))/(n0[1]*dx[1]);
374  }
375 
376  // Ray-zAxis intersection
377  if(std::abs(n0[2]) > std::numeric_limits<Real>::epsilon()) {
378  alpha[4] = (p - dot_product(n0,vertex[0]))/(n0[2]*dx[2]);
379  alpha[5] = (p - dot_product(n0,vertex[1]))/(n0[2]*dx[2]);
380  alpha[6] = (p - dot_product(n0,vertex[3]))/(n0[2]*dx[2]);
381  alpha[7] = (p - dot_product(n0,vertex[2]))/(n0[2]*dx[2]);
382  }
383 }

◆ calc_hesse()

void eb_::EBToPVD::calc_hesse ( Real &  distance,
std::array< Real, 3 > &  n0,
Real &  p,
const std::array< Real, 3 > &  normal,
const std::array< Real, 3 > &  centroid 
)
staticprivate
334 {
335  Real sign_of_dist;
336 
337  // General equation of a plane: Ax + By + Cz + D = 0
338  // here D := distance
339  distance = -dot_product(normal, centroid);
340 
341  // Get the sign of the distance
342  sign_of_dist = -distance / std::abs(distance);
343 
344  // Get the Hessian form
345  Real fac = sign_of_dist/dot_product(normal, normal);
346  for(int idim = 0; idim < 3; ++idim) {
347  n0[idim] = fac*normal[idim];
348  }
349  p = sign_of_dist*(-distance);
350 }

◆ calc_intersects()

void eb_::EBToPVD::calc_intersects ( int &  int_count,
std::array< bool, 12 > &  intersects_flags,
const std::array< Real, 12 > &  alpha 
)
staticprivate
387 {
388  int_count = 0;
389  std::fill(intersects_flags.begin(), intersects_flags.end(), false);
390 
391  for(int lc1 = 0; lc1 < 12; ++lc1) {
392  if(intersects(alpha[lc1])) {
393  ++int_count;
394  intersects_flags[lc1] = true;
395  }
396  }
397 }

◆ EBGridCoverage()

void eb_::EBToPVD::EBGridCoverage ( int  myID,
const Real *  problo,
const Real *  dx,
const Box &  bx,
Array4< EBCellFlag const > const &  flag 
)
439 {
440  int lc1 = 0;
441 
442  const auto lo = lbound(bx);
443  const auto hi = ubound(bx);
444 
445  std::array<int,3> nodes = {hi.x-lo.x + 1, hi.y-lo.y + 1, hi.z-lo.z + 1};
446  std::array<int,3> low = {lo.x, lo.y, lo.z};
447 
448  for(int k = lo.z; k <= hi.z; ++k) {
449  for(int j = lo.y; j <= hi.y; ++j) {
450  for(int i = lo.x; i <= hi.x; ++i)
451  {
452  if(flag(i,j,k).isSingleValued()) {
453  lc1 = lc1 + 1;
454  }
455  }
456  }
457  };
458 
459  ++m_grid;
460  if(lc1 == 0) { return; }
461 
462  std::stringstream ss;
463  ss << std::setw(4) << std::setfill('0') << myID;
464  std::string cID = ss.str();
465 
466  ss.str("");
467  ss.clear();
468  ss << std::setw(4) << std::setfill('0') << m_grid;
469  std::string cgrid = ss.str();
470  std::string fname = "eb_grid_" + cID + "_" + cgrid + ".vtr";
471 
472  std::ofstream myfile(fname);
473  if(myfile.is_open()) {
474  myfile.precision(6);
475  myfile << "<?xml version=\"1.0\"?>\n";
476  myfile << "<VTKFile type=\"RectilinearGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
477  myfile << "<RectilinearGrid WholeExtent=\" 0 "
478  << nodes[0] << " 0 " << nodes[1] << " 0 " << nodes[2] << "\">\n";
479  myfile << "<Piece Extent=\" 0 "
480  << nodes[0] << " 0 " << nodes[1] << " 0 " << nodes[2] << "\">\n";
481  myfile << "<Coordinates>\n";
482 
483  for(int idim = 0; idim < 3; ++idim) {
484  std::vector<Real> lines(nodes[idim]+1);
485  Real grid_start = problo[idim] + static_cast<Real>(low[idim])*dx[idim];
486  for(int llc = 0; llc <= nodes[idim]; ++llc) {
487  lines[llc] = grid_start + static_cast<Real>(llc)*dx[idim];
488  }
489 
490  myfile << "<DataArray type=\"Float32\" format=\"ascii\" RangeMin=\"" // NOLINT
491  << std::fixed
492  << lines[0] << "\" RangeMax=\"" << lines[nodes[idim]] << "\">\n";
493 
494  for(auto line : lines) {
495  myfile << " " << line;
496  }
497  myfile << "\n";
498 
499  myfile << "</DataArray>\n";
500  }
501 
502  myfile << "</Coordinates>\n";
503  myfile << "</Piece>\n";
504  myfile << "</RectilinearGrid>\n";
505  myfile << "</VTKFile>\n";
506  }
507 
508  myfile.close();
509 }
int m_grid
Definition: ERF_EBToPVD.H:56

Referenced by eb_::WriteEBSurface().

Here is the caller graph for this function:

◆ EBToPolygon()

void eb_::EBToPVD::EBToPolygon ( const Real *  problo,
const Real *  dx,
const Box &  bx,
Array4< EBCellFlag const > const &  flag,
Array4< Real const > const &  bcent,
Array4< Real const > const &  apx,
Array4< Real const > const &  apy,
Array4< Real const > const &  apz 
)
34 {
35  const auto lo = lbound(bx);
36  const auto hi = ubound(bx);
37 
38  for(int k = lo.z; k <= hi.z; ++k) {
39  for(int j = lo.y; j <= hi.y; ++j) {
40  for(int i = lo.x; i <= hi.x; ++i) {
41  // NOTE: do not skip fully enclosed cells (is_covered_cell), as this seems
42  // to skip thin walls in the domain:
43  // if(.not.is_regular_cell(flag(i,j,k)) .and. &
44  // .not.is_covered_cell(flag(i,j,k))) then
45 
46  // Instead only look for EBs
47  // if( .not.is_regular_cell(flag(i,j,k))) then
48 
49  // If covered cells are accounted for in this loop, a FPE arises
50  // since apnorm is zero.
51 
52  if(flag(i,j,k).isSingleValued()) {
53 
54  // Boundary normal vector
55 
56  Real axm = apx(i ,j ,k );
57  Real axp = apx(i+1,j ,k );
58  Real aym = apy(i ,j ,k );
59  Real ayp = apy(i ,j+1,k );
60  Real azm = apz(i ,j ,k );
61  Real azp = apz(i ,j ,k+1);
62 
63  Real adx = (axm-axp) * dx[1] * dx[2];
64  Real ady = (aym-ayp) * dx[0] * dx[2];
65  Real adz = (azm-azp) * dx[0] * dx[1];
66 
67  Real apnorm = std::sqrt(adx*adx + ady*ady + adz*adz);
68  Real apnorminv = Real(1.0)/apnorm;
69 
70  std::array<Real,3> normal, centroid;
71  std::array<std::array<Real,3>,8> vertex;
72 
73  normal[0] = adx * apnorminv;
74  normal[1] = ady * apnorminv;
75  normal[2] = adz * apnorminv;
76 
77  // convert bcent to global coordinate system centered at plo
78 
79  centroid[0] = problo[0] + bcent(i,j,k,0)*dx[0] + (static_cast<Real>(i) + Real(0.5))*dx[0];
80  centroid[1] = problo[1] + bcent(i,j,k,1)*dx[1] + (static_cast<Real>(j) + Real(0.5))*dx[1];
81  centroid[2] = problo[2] + bcent(i,j,k,2)*dx[2] + (static_cast<Real>(k) + Real(0.5))*dx[2];
82 
83  // vertices of bounding cell (i,j,k)
84  vertex[0] = {problo[0] + static_cast<Real>(i )*dx[0], problo[1] + static_cast<Real>(j )*dx[1], problo[2] + static_cast<Real>(k )*dx[2]};
85  vertex[1] = {problo[0] + static_cast<Real>(i+1)*dx[0], problo[1] + static_cast<Real>(j )*dx[1], problo[2] + static_cast<Real>(k )*dx[2]};
86  vertex[2] = {problo[0] + static_cast<Real>(i )*dx[0], problo[1] + static_cast<Real>(j+1)*dx[1], problo[2] + static_cast<Real>(k )*dx[2]};
87  vertex[3] = {problo[0] + static_cast<Real>(i+1)*dx[0], problo[1] + static_cast<Real>(j+1)*dx[1], problo[2] + static_cast<Real>(k )*dx[2]};
88  vertex[4] = {problo[0] + static_cast<Real>(i )*dx[0], problo[1] + static_cast<Real>(j )*dx[1], problo[2] + static_cast<Real>(k+1)*dx[2]};
89  vertex[5] = {problo[0] + static_cast<Real>(i+1)*dx[0], problo[1] + static_cast<Real>(j )*dx[1], problo[2] + static_cast<Real>(k+1)*dx[2]};
90  vertex[6] = {problo[0] + static_cast<Real>(i )*dx[0], problo[1] + static_cast<Real>(j+1)*dx[1], problo[2] + static_cast<Real>(k+1)*dx[2]};
91  vertex[7] = {problo[0] + static_cast<Real>(i+1)*dx[0], problo[1] + static_cast<Real>(j+1)*dx[1], problo[2] + static_cast<Real>(k+1)*dx[2]};
92 
93  // NOTE: this seems to be unnecessary:
94  // skip cells that have a tiny intersection and cells that have
95  // the centroid on a face/edge/corner
96  // if(apnorm > stol .and. &
97  // vertex(1,1) < centroid(1) .and. centroid(1) < vertex(8,1) .and. &
98  // vertex(1,2) < centroid(2) .and. centroid(2) < vertex(8,2) .and. &
99  // vertex(1,3) < centroid(3) .and. centroid(3) < vertex(8,3)) then
100 
101  // Compute EB facets for current cell
102  int count;
103  Real distance, p;
104  std::array<Real,3> n0;
105  std::array<Real,12> alpha;
106  std::array<bool,12> alpha_intersect;
107 
108  calc_hesse(distance, n0, p, normal, centroid);
109  calc_alpha(alpha, n0, p, vertex, dx);
110  calc_intersects(count, alpha_intersect, alpha);
111 
112  // If the number of facet "contained" in does not describe a facet:
113  // ... I.e. there's less than 3 (not even a triangle) or more than 6
114  // ... (I have no idea what that is):
115  // => Move the centroid a little back and forth along the normal
116  // to see if that makes a difference:
117 
118  if((count < 3) || (count > 6)) {
119  int count_d;
120  Real p_d;
121  std::array<Real,3> n0_d;
122  std::array<Real,12> alpha_d;
123  std::array<bool,12> alpha_d_intersect;
124 
125  Real tol = std::min({dx[0], dx[1], dx[2]})/Real(100.); // bit of a fudge factor
126 
127  std::array<Real,3> centroid_d;
128  for(int idim = 0; idim < 3; ++idim) {
129  centroid_d[idim] = centroid[idim] + tol*normal[idim];
130  }
131 
132  calc_hesse(distance, n0_d, p_d, normal, centroid_d);
133  calc_alpha(alpha_d, n0_d, p_d, vertex, dx);
134  calc_intersects(count_d, alpha_d_intersect, alpha_d);
135  if((count_d >= 3) && (count_d <= 6)) {
136  count = count_d;
137  alpha_intersect = alpha_d_intersect;
138  }
139 
140  for(int idim = 0; idim < 3; ++idim) {
141  centroid_d[idim] = centroid[idim] - tol*normal[idim];
142  }
143 
144  calc_hesse(distance, n0_d, p_d, normal, centroid_d);
145  calc_alpha(alpha_d, n0_d, p_d, vertex, dx);
146  calc_intersects(count_d, alpha_d_intersect, alpha_d);
147  if((count_d >= 3) && (count_d <= 6)) {
148  count = count_d;
149  alpha_intersect = alpha_d_intersect;
150  }
151  }
152  // I know this was a bit of a hack, but it's the only way I prevent
153  // missing facets...
154 
155  if((count >=3) && (count <=6)) {
156  m_connectivity.push_back({0,0,0,0,0,0,0});
157 
158  // calculate intersection points.
159  std::array<std::array<Real,3>,12> a_points;
160 
161  std::array<Real,3> ihat = {1, 0, 0};
162  std::array<Real,3> jhat = {0, 1, 0};
163  std::array<Real,3> khat = {0, 0, 1};
164 
165  for(int idim = 0; idim < 3; ++idim) {
166  a_points[ 0][idim] = vertex[0][idim] + ihat[idim]*dx[0]*alpha[ 0];
167  a_points[ 1][idim] = vertex[1][idim] + jhat[idim]*dx[1]*alpha[ 1];
168  a_points[ 2][idim] = vertex[2][idim] + ihat[idim]*dx[0]*alpha[ 2];
169  a_points[ 3][idim] = vertex[0][idim] + jhat[idim]*dx[1]*alpha[ 3];
170  a_points[ 4][idim] = vertex[0][idim] + khat[idim]*dx[2]*alpha[ 4];
171  a_points[ 5][idim] = vertex[1][idim] + khat[idim]*dx[2]*alpha[ 5];
172  a_points[ 6][idim] = vertex[3][idim] + khat[idim]*dx[2]*alpha[ 6];
173  a_points[ 7][idim] = vertex[2][idim] + khat[idim]*dx[2]*alpha[ 7];
174  a_points[ 8][idim] = vertex[4][idim] + ihat[idim]*dx[0]*alpha[ 8];
175  a_points[ 9][idim] = vertex[5][idim] + jhat[idim]*dx[1]*alpha[ 9];
176  a_points[10][idim] = vertex[6][idim] + ihat[idim]*dx[0]*alpha[10];
177  a_points[11][idim] = vertex[4][idim] + jhat[idim]*dx[1]*alpha[11];
178  }
179 
180  // store intersections with grid cell alpha in [0,1]
181  for(int lc1 = 0; lc1 < 12; ++lc1) {
182  if(alpha_intersect[lc1]) {
183  m_points.push_back(a_points[lc1]);
184  int lc2 = m_connectivity.back()[0]+1;
185  m_connectivity.back()[0] = lc2;
186  m_connectivity.back()[lc2] = static_cast<int>(m_points.size()-1);
187  }
188  }
189 
191  }
192  }
193  }
194  }
195  };
196 }
std::vector< std::array< Real, 3 > > m_points
Definition: ERF_EBToPVD.H:54
static void calc_intersects(int &int_count, std::array< bool, 12 > &intersects_flags, const std::array< Real, 12 > &alpha)
Definition: ERF_EBToPVD.cpp:385
void reorder_polygon(const std::vector< std::array< Real, 3 >> &lpoints, std::array< int, 7 > &lconnect, const std::array< Real, 3 > &lnormal)
Definition: ERF_EBToPVD.cpp:251
static void calc_alpha(std::array< Real, 12 > &alpha, const std::array< Real, 3 > &n0, Real p, const std::array< std::array< Real, 3 >, 8 > &vertex, const Real *dx)
Definition: ERF_EBToPVD.cpp:352
std::vector< std::array< int, 7 > > m_connectivity
Definition: ERF_EBToPVD.H:55
static void calc_hesse(Real &distance, std::array< Real, 3 > &n0, Real &p, const std::array< Real, 3 > &normal, const std::array< Real, 3 > &centroid)
Definition: ERF_EBToPVD.cpp:332

Referenced by eb_::WriteEBSurface().

Here is the caller graph for this function:

◆ print_connectivity()

void eb_::EBToPVD::print_connectivity ( std::ofstream &  myfile) const
private
414 {
415  myfile << "<Polys>\n";
416  myfile << "<DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n";
417  for(const auto & lc1 : m_connectivity) {
418  for(int lc2 = 1; lc2 <= lc1[0]; ++lc2) {
419  myfile << " " << lc1[lc2];
420  }
421  myfile << "\n";
422  }
423  myfile << "</DataArray>\n";
424 
425  myfile << "<DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n";
426  int lc2 = 0;
427  for(const auto & lc1 : m_connectivity) {
428  lc2 = lc2 + lc1[0];
429  myfile << " " << lc2;
430  }
431  myfile << "\n";
432  myfile << "</DataArray>\n";
433 
434  myfile << "</Polys>\n";
435 }

◆ print_grids()

void eb_::EBToPVD::print_grids ( std::ofstream &  myfile) const
private

◆ print_points()

void eb_::EBToPVD::print_points ( std::ofstream &  myfile) const
private
400 {
401  myfile << "<Points>\n";
402  myfile << "<DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n";
403 
404  for(const auto & m_point : m_points) {
405  myfile << std::fixed << std::scientific
406  << m_point[0] << " " << m_point[1] << " " << m_point[2] << "\n";
407  }
408 
409  myfile << "</DataArray>\n";
410  myfile << "</Points>\n";
411 }

◆ reorder_polygon()

void eb_::EBToPVD::reorder_polygon ( const std::vector< std::array< Real, 3 >> &  lpoints,
std::array< int, 7 > &  lconnect,
const std::array< Real, 3 > &  lnormal 
)
private
254 {
255  std::array<Real,3> center;
256  center.fill(0.0);
257 
258  int longest = 2;
259  if(std::abs(lnormal[0]) > std::abs(lnormal[1])) {
260  if(std::abs(lnormal[0]) > std::abs(lnormal[2])) {
261  longest = 0;
262  }
263  }
264  else {
265  if(std::abs(lnormal[1]) > std::abs(lnormal[2])) {
266  longest = 1;
267  }
268  }
269 
270  for(int i = 1; i <= lconnect[0]; ++i) {
271  center[0] += m_points[lconnect[i]][0];
272  center[1] += m_points[lconnect[i]][1];
273  center[2] += m_points[lconnect[i]][2];
274  }
275  center = {center[0]/static_cast<Real>(lconnect[0]),
276  center[1]/static_cast<Real>(lconnect[0]),
277  center[2]/static_cast<Real>(lconnect[0])};
278 
279  int pi, pk;
280  Real ref_angle, angle;
281  if(longest == 0)
282  {
283  for(int i = 1; i <= lconnect[0]-1; ++i) {
284  pi = lconnect[i];
285  ref_angle = std::atan2(lpoints[pi][2]-center[2], lpoints[pi][1]-center[1]);
286  for(int k = i+1; k <= lconnect[0]; ++k) {
287  pk = lconnect[k];
288  angle = std::atan2(lpoints[pk][2]-center[2], lpoints[pk][1]-center[1]);
289  if(angle < ref_angle) {
290  ref_angle = angle;
291  lconnect[k] = pi;
292  lconnect[i] = pk;
293  pi = pk;
294  }
295  }
296  }
297  }
298  else if(longest == 1) {
299  for(int i = 1; i <= lconnect[0]-1; ++i) {
300  pi = lconnect[i];
301  ref_angle = std::atan2(lpoints[pi][0]-center[0], lpoints[pi][2]-center[2]);
302  for(int k = i+1; k <= lconnect[0]; ++k) {
303  pk = lconnect[k];
304  angle = std::atan2(lpoints[pk][0]-center[0], lpoints[pk][2]-center[2]);
305  if(angle < ref_angle) {
306  ref_angle = angle;
307  lconnect[k] = pi;
308  lconnect[i] = pk;
309  pi = pk;
310  }
311  }
312  }
313  }
314  else if(longest == 2) {
315  for(int i = 1; i <= lconnect[0]-1; ++i) {
316  pi = lconnect[i];
317  ref_angle = std::atan2(lpoints[pi][1]-center[1], lpoints[pi][0]-center[0]);
318  for(int k = i+1; k <= lconnect[0]; ++k) {
319  pk = lconnect[k];
320  angle = std::atan2(lpoints[pk][1]-center[1], lpoints[pk][0]-center[0]);
321  if(angle < ref_angle) {
322  ref_angle = angle;
323  lconnect[k] = pi;
324  lconnect[i] = pk;
325  pi = pk;
326  }
327  }
328  }
329  }
330 }

◆ WriteEBVTP()

void eb_::EBToPVD::WriteEBVTP ( int  myID,
int  level 
) const
199 {
200  std::stringstream ss;
201  ss << std::setw(8) << std::setfill('0') << myID << "_level_"<< level;
202  std::string cID = "eb_" + ss.str() + ".vtp";
203 
204  std::ofstream myfile(cID);
205  if(myfile.is_open()) {
206  myfile.precision(6);
207  myfile << "<?xml version=\"1.0\"?>\n";
208  myfile << "<VTKFile type=\"PolyData\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
209  myfile << "<PolyData>\n";
210  myfile << "<Piece NumberOfPoints=\"" << m_points.size() << "\" NumberOfVerts=\"0\" " // NOLINT
211  << "NumberOfLines=\"0\" NumberOfString=\"0\" NumberOfPolys=\" " // NOLINT
212  << m_connectivity.size() << "\">\n";
213  print_points(myfile);
214  print_connectivity(myfile);
215  myfile << "<PointData></PointData>\n";
216  myfile << "<CellData></CellData>\n";
217  myfile << "</Piece>\n";
218  myfile << "</PolyData>\n";
219  myfile << "</VTKFile>\n";
220 
221  myfile.close();
222  }
223 }
void print_connectivity(std::ofstream &myfile) const
Definition: ERF_EBToPVD.cpp:413
void print_points(std::ofstream &myfile) const
Definition: ERF_EBToPVD.cpp:399

Referenced by eb_::WriteEBSurface().

Here is the caller graph for this function:

◆ WritePVTP()

void eb_::EBToPVD::WritePVTP ( int  nProcs)
static
226 {
227  std::ofstream myfile("eb.pvtp");
228 
229  if(myfile.is_open()) {
230  myfile << "<?xml version=\"1.0\"?>\n";
231  myfile << "<VTKFile type=\"PPolyData\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
232  myfile << "<PPolyData GhostLevel=\"0\">\n";
233  myfile << "<PPointData/>\n";
234  myfile << "<PCellData/>\n";
235  myfile << "<PPoints>\n";
236  myfile << "<PDataArray type=\"Float32\" NumberOfComponents=\"3\"/>\n";
237  myfile << "</PPoints>\n";
238 
239  for(int lc1 = 0; lc1 < nProcs; ++lc1) {
240  std::stringstream ss;
241  ss << std::setw(8) << std::setfill('0') << lc1;
242  std::string clc1 = "eb_" + ss.str() + ".vtp";
243  myfile << "<Piece Source=\"" << clc1 << "\"/>\n";
244  }
245 
246  myfile << "</PPolyData>\n";
247  myfile << "</VTKFile>\n";
248  myfile.close();
249  }
250 }

Referenced by eb_::WriteEBSurface().

Here is the caller graph for this function:

Member Data Documentation

◆ m_connectivity

std::vector<std::array<int,7> > eb_::EBToPVD::m_connectivity
private

◆ m_grid

int eb_::EBToPVD::m_grid {0}
private

◆ m_points

std::vector<std::array<Real,3> > eb_::EBToPVD::m_points
private

The documentation for this class was generated from the following files: