ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
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) 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
368 {
369  // default (large) value
370  std::fill(alpha.begin(), alpha.end(), 10.0);
371 
372  // Ray-xAxis intersection
373  if(std::abs(n0[0]) > std::numeric_limits<Real>::epsilon()) {
374  alpha[0] = (p - dot_product(n0,vertex[0]))/(n0[0]*dx[0]);
375  alpha[2] = (p - dot_product(n0,vertex[2]))/(n0[0]*dx[0]);
376  alpha[8] = (p - dot_product(n0,vertex[4]))/(n0[0]*dx[0]);
377  alpha[10] = (p - dot_product(n0,vertex[6]))/(n0[0]*dx[0]);
378  }
379 
380  // Ray-yAxis intersection
381  if(std::abs(n0[1]) > std::numeric_limits<Real>::epsilon()) {
382  alpha[1] = (p - dot_product(n0,vertex[1]))/(n0[1]*dx[1]);
383  alpha[3] = (p - dot_product(n0,vertex[0]))/(n0[1]*dx[1]);
384  alpha[9] = (p - dot_product(n0,vertex[5]))/(n0[1]*dx[1]);
385  alpha[11] = (p - dot_product(n0,vertex[4]))/(n0[1]*dx[1]);
386  }
387 
388  // Ray-zAxis intersection
389  if(std::abs(n0[2]) > std::numeric_limits<Real>::epsilon()) {
390  alpha[4] = (p - dot_product(n0,vertex[0]))/(n0[2]*dx[2]);
391  alpha[5] = (p - dot_product(n0,vertex[1]))/(n0[2]*dx[2]);
392  alpha[6] = (p - dot_product(n0,vertex[3]))/(n0[2]*dx[2]);
393  alpha[7] = (p - dot_product(n0,vertex[2]))/(n0[2]*dx[2]);
394  }
395 }

◆ 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
346 {
347  Real sign_of_dist;
348 
349  // General equation of a plane: Ax + By + Cz + D = 0
350  // here D := distance
351  distance = -dot_product(normal, centroid);
352 
353  // Get the sign of the distance
354  sign_of_dist = -distance / std::abs(distance);
355 
356  // Get the Hessian form
357  Real fac = sign_of_dist/dot_product(normal, normal);
358  for(int idim = 0; idim < 3; ++idim) {
359  n0[idim] = fac*normal[idim];
360  }
361  p = sign_of_dist*(-distance);
362 }

◆ calc_intersects()

void eb_::EBToPVD::calc_intersects ( int &  int_count,
std::array< bool, 12 > &  intersects_flags,
const std::array< Real, 12 > &  alpha 
)
staticprivate
399 {
400  int_count = 0;
401  std::fill(intersects_flags.begin(), intersects_flags.end(), false);
402 
403  for(int lc1 = 0; lc1 < 12; ++lc1) {
404  if(intersects(alpha[lc1])) {
405  ++int_count;
406  intersects_flags[lc1] = true;
407  }
408  }
409 }

◆ EBGridCoverage()

void eb_::EBToPVD::EBGridCoverage ( int  myID,
const Real *  problo,
const Real *  dx,
const Box &  bx,
Array4< EBCellFlag const > const &  flag 
)
451 {
452  int lc1 = 0;
453 
454  const auto lo = lbound(bx);
455  const auto hi = ubound(bx);
456 
457  std::array<int,3> nodes = {hi.x-lo.x + 1, hi.y-lo.y + 1, hi.z-lo.z + 1};
458  std::array<int,3> low = {lo.x, lo.y, lo.z};
459 
460  for(int k = lo.z; k <= hi.z; ++k) {
461  for(int j = lo.y; j <= hi.y; ++j) {
462  for(int i = lo.x; i <= hi.x; ++i)
463  {
464  if(flag(i,j,k).isSingleValued()) {
465  lc1 = lc1 + 1;
466  }
467  }
468  }
469  };
470 
471  ++m_grid;
472  if(lc1 == 0) { return; }
473 
474  std::stringstream ss;
475  ss << std::setw(4) << std::setfill('0') << myID;
476  std::string cID = ss.str();
477 
478  ss.str("");
479  ss.clear();
480  ss << std::setw(4) << std::setfill('0') << m_grid;
481  std::string cgrid = ss.str();
482  std::string fname = "eb_grid_" + cID + "_" + cgrid + ".vtr";
483 
484  std::ofstream myfile(fname);
485  if(myfile.is_open()) {
486  myfile.precision(6);
487  myfile << "<?xml version=\"1.0\"?>\n";
488  myfile << "<VTKFile type=\"RectilinearGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
489  myfile << "<RectilinearGrid WholeExtent=\" 0 "
490  << nodes[0] << " 0 " << nodes[1] << " 0 " << nodes[2] << "\">\n";
491  myfile << "<Piece Extent=\" 0 "
492  << nodes[0] << " 0 " << nodes[1] << " 0 " << nodes[2] << "\">\n";
493  myfile << "<Coordinates>\n";
494 
495  for(int idim = 0; idim < 3; ++idim) {
496  std::vector<Real> lines(nodes[idim]+1);
497  Real grid_start = problo[idim] + static_cast<Real>(low[idim])*dx[idim];
498  for(int llc = 0; llc <= nodes[idim]; ++llc) {
499  lines[llc] = grid_start + static_cast<Real>(llc)*dx[idim];
500  }
501 
502  myfile << "<DataArray type=\"Float32\" format=\"ascii\" RangeMin=\"" // NOLINT
503  << std::fixed
504  << lines[0] << "\" RangeMax=\"" << lines[nodes[idim]] << "\">\n";
505 
506  for(auto line : lines) {
507  myfile << " " << line;
508  }
509  myfile << "\n";
510 
511  myfile << "</DataArray>\n";
512  }
513 
514  myfile << "</Coordinates>\n";
515  myfile << "</Piece>\n";
516  myfile << "</RectilinearGrid>\n";
517  myfile << "</VTKFile>\n";
518  }
519 
520  myfile.close();
521 }
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  Real norm = ( (normal[0]*dx[0])*(normal[0]*dx[0])
84  + (normal[1]*dx[1])*(normal[1]*dx[1])
85  + (normal[2]*dx[2])*(normal[2]*dx[2]) );
86 
87  Real bcent_isoparam_x = bcent(i,j,k,0) / norm * dx[1] * dx[2];
88  Real bcent_isoparam_y = bcent(i,j,k,1) / norm * dx[0] * dx[2];
89  Real bcent_isoparam_z = bcent(i,j,k,2) / norm * dx[0] * dx[1];
90 
91  centroid[0] = problo[0] + bcent_isoparam_x*dx[0] + (static_cast<Real>(i) + Real(0.5))*dx[0];
92  centroid[1] = problo[1] + bcent_isoparam_y*dx[1] + (static_cast<Real>(j) + Real(0.5))*dx[1];
93  centroid[2] = problo[2] + bcent_isoparam_z*dx[2] + (static_cast<Real>(k) + Real(0.5))*dx[2];
94 
95  // vertices of bounding cell (i,j,k)
96  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]};
97  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]};
98  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]};
99  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]};
100  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]};
101  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]};
102  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]};
103  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]};
104 
105  // NOTE: this seems to be unnecessary:
106  // skip cells that have a tiny intersection and cells that have
107  // the centroid on a face/edge/corner
108  // if(apnorm > stol .and. &
109  // vertex(1,1) < centroid(1) .and. centroid(1) < vertex(8,1) .and. &
110  // vertex(1,2) < centroid(2) .and. centroid(2) < vertex(8,2) .and. &
111  // vertex(1,3) < centroid(3) .and. centroid(3) < vertex(8,3)) then
112 
113  // Compute EB facets for current cell
114  int count;
115  Real distance, p;
116  std::array<Real,3> n0;
117  std::array<Real,12> alpha;
118  std::array<bool,12> alpha_intersect;
119 
120  calc_hesse(distance, n0, p, normal, centroid);
121  calc_alpha(alpha, n0, p, vertex, dx);
122  calc_intersects(count, alpha_intersect, alpha);
123 
124  // If the number of facet "contained" in does not describe a facet:
125  // ... I.e. there's less than 3 (not even a triangle) or more than 6
126  // ... (I have no idea what that is):
127  // => Move the centroid a little back and forth along the normal
128  // to see if that makes a difference:
129 
130  if((count < 3) || (count > 6)) {
131  int count_d;
132  Real p_d;
133  std::array<Real,3> n0_d;
134  std::array<Real,12> alpha_d;
135  std::array<bool,12> alpha_d_intersect;
136 
137  Real tol = std::min({dx[0], dx[1], dx[2]})/Real(100.); // bit of a fudge factor
138 
139  std::array<Real,3> centroid_d;
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  for(int idim = 0; idim < 3; ++idim) {
153  centroid_d[idim] = centroid[idim] - tol*normal[idim];
154  }
155 
156  calc_hesse(distance, n0_d, p_d, normal, centroid_d);
157  calc_alpha(alpha_d, n0_d, p_d, vertex, dx);
158  calc_intersects(count_d, alpha_d_intersect, alpha_d);
159  if((count_d >= 3) && (count_d <= 6)) {
160  count = count_d;
161  alpha_intersect = alpha_d_intersect;
162  }
163  }
164  // I know this was a bit of a hack, but it's the only way I prevent
165  // missing facets...
166 
167  if((count >=3) && (count <=6)) {
168  m_connectivity.push_back({0,0,0,0,0,0,0});
169 
170  // calculate intersection points.
171  std::array<std::array<Real,3>,12> a_points;
172 
173  std::array<Real,3> ihat = {1, 0, 0};
174  std::array<Real,3> jhat = {0, 1, 0};
175  std::array<Real,3> khat = {0, 0, 1};
176 
177  for(int idim = 0; idim < 3; ++idim) {
178  a_points[ 0][idim] = vertex[0][idim] + ihat[idim]*dx[0]*alpha[ 0];
179  a_points[ 1][idim] = vertex[1][idim] + jhat[idim]*dx[1]*alpha[ 1];
180  a_points[ 2][idim] = vertex[2][idim] + ihat[idim]*dx[0]*alpha[ 2];
181  a_points[ 3][idim] = vertex[0][idim] + jhat[idim]*dx[1]*alpha[ 3];
182  a_points[ 4][idim] = vertex[0][idim] + khat[idim]*dx[2]*alpha[ 4];
183  a_points[ 5][idim] = vertex[1][idim] + khat[idim]*dx[2]*alpha[ 5];
184  a_points[ 6][idim] = vertex[3][idim] + khat[idim]*dx[2]*alpha[ 6];
185  a_points[ 7][idim] = vertex[2][idim] + khat[idim]*dx[2]*alpha[ 7];
186  a_points[ 8][idim] = vertex[4][idim] + ihat[idim]*dx[0]*alpha[ 8];
187  a_points[ 9][idim] = vertex[5][idim] + jhat[idim]*dx[1]*alpha[ 9];
188  a_points[10][idim] = vertex[6][idim] + ihat[idim]*dx[0]*alpha[10];
189  a_points[11][idim] = vertex[4][idim] + jhat[idim]*dx[1]*alpha[11];
190  }
191 
192  // store intersections with grid cell alpha in [0,1]
193  for(int lc1 = 0; lc1 < 12; ++lc1) {
194  if(alpha_intersect[lc1]) {
195  m_points.push_back(a_points[lc1]);
196  int lc2 = m_connectivity.back()[0]+1;
197  m_connectivity.back()[0] = lc2;
198  m_connectivity.back()[lc2] = static_cast<int>(m_points.size()-1);
199  }
200  }
201 
203  }
204  }
205  }
206  }
207  };
208 }
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:397
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:263
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:364
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:344

Referenced by eb_::WriteEBSurface().

Here is the caller graph for this function:

◆ print_connectivity()

void eb_::EBToPVD::print_connectivity ( std::ofstream &  myfile) const
private
426 {
427  myfile << "<Polys>\n";
428  myfile << "<DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n";
429  for(const auto & lc1 : m_connectivity) {
430  for(int lc2 = 1; lc2 <= lc1[0]; ++lc2) {
431  myfile << " " << lc1[lc2];
432  }
433  myfile << "\n";
434  }
435  myfile << "</DataArray>\n";
436 
437  myfile << "<DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n";
438  int lc2 = 0;
439  for(const auto & lc1 : m_connectivity) {
440  lc2 = lc2 + lc1[0];
441  myfile << " " << lc2;
442  }
443  myfile << "\n";
444  myfile << "</DataArray>\n";
445 
446  myfile << "</Polys>\n";
447 }

◆ print_grids()

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

◆ print_points()

void eb_::EBToPVD::print_points ( std::ofstream &  myfile) const
private
412 {
413  myfile << "<Points>\n";
414  myfile << "<DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n";
415 
416  for(const auto & m_point : m_points) {
417  myfile << std::fixed << std::scientific
418  << m_point[0] << " " << m_point[1] << " " << m_point[2] << "\n";
419  }
420 
421  myfile << "</DataArray>\n";
422  myfile << "</Points>\n";
423 }

◆ 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
266 {
267  std::array<Real,3> center;
268  center.fill(0.0);
269 
270  int longest = 2;
271  if(std::abs(lnormal[0]) > std::abs(lnormal[1])) {
272  if(std::abs(lnormal[0]) > std::abs(lnormal[2])) {
273  longest = 0;
274  }
275  }
276  else {
277  if(std::abs(lnormal[1]) > std::abs(lnormal[2])) {
278  longest = 1;
279  }
280  }
281 
282  for(int i = 1; i <= lconnect[0]; ++i) {
283  center[0] += m_points[lconnect[i]][0];
284  center[1] += m_points[lconnect[i]][1];
285  center[2] += m_points[lconnect[i]][2];
286  }
287  center = {center[0]/static_cast<Real>(lconnect[0]),
288  center[1]/static_cast<Real>(lconnect[0]),
289  center[2]/static_cast<Real>(lconnect[0])};
290 
291  int pi, pk;
292  Real ref_angle, angle;
293  if(longest == 0)
294  {
295  for(int i = 1; i <= lconnect[0]-1; ++i) {
296  pi = lconnect[i];
297  ref_angle = std::atan2(lpoints[pi][2]-center[2], lpoints[pi][1]-center[1]);
298  for(int k = i+1; k <= lconnect[0]; ++k) {
299  pk = lconnect[k];
300  angle = std::atan2(lpoints[pk][2]-center[2], lpoints[pk][1]-center[1]);
301  if(angle < ref_angle) {
302  ref_angle = angle;
303  lconnect[k] = pi;
304  lconnect[i] = pk;
305  pi = pk;
306  }
307  }
308  }
309  }
310  else if(longest == 1) {
311  for(int i = 1; i <= lconnect[0]-1; ++i) {
312  pi = lconnect[i];
313  ref_angle = std::atan2(lpoints[pi][0]-center[0], lpoints[pi][2]-center[2]);
314  for(int k = i+1; k <= lconnect[0]; ++k) {
315  pk = lconnect[k];
316  angle = std::atan2(lpoints[pk][0]-center[0], lpoints[pk][2]-center[2]);
317  if(angle < ref_angle) {
318  ref_angle = angle;
319  lconnect[k] = pi;
320  lconnect[i] = pk;
321  pi = pk;
322  }
323  }
324  }
325  }
326  else if(longest == 2) {
327  for(int i = 1; i <= lconnect[0]-1; ++i) {
328  pi = lconnect[i];
329  ref_angle = std::atan2(lpoints[pi][1]-center[1], lpoints[pi][0]-center[0]);
330  for(int k = i+1; k <= lconnect[0]; ++k) {
331  pk = lconnect[k];
332  angle = std::atan2(lpoints[pk][1]-center[1], lpoints[pk][0]-center[0]);
333  if(angle < ref_angle) {
334  ref_angle = angle;
335  lconnect[k] = pi;
336  lconnect[i] = pk;
337  pi = pk;
338  }
339  }
340  }
341  }
342 }

◆ WriteEBVTP()

void eb_::EBToPVD::WriteEBVTP ( int  myID) const
211 {
212  std::stringstream ss;
213  ss << std::setw(8) << std::setfill('0') << myID;
214  std::string cID = "eb_" + ss.str() + ".vtp";
215 
216  std::ofstream myfile(cID);
217  if(myfile.is_open()) {
218  myfile.precision(6);
219  myfile << "<?xml version=\"1.0\"?>\n";
220  myfile << "<VTKFile type=\"PolyData\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
221  myfile << "<PolyData>\n";
222  myfile << "<Piece NumberOfPoints=\"" << m_points.size() << "\" NumberOfVerts=\"0\" " // NOLINT
223  << "NumberOfLines=\"0\" NumberOfString=\"0\" NumberOfPolys=\" " // NOLINT
224  << m_connectivity.size() << "\">\n";
225  print_points(myfile);
226  print_connectivity(myfile);
227  myfile << "<PointData></PointData>\n";
228  myfile << "<CellData></CellData>\n";
229  myfile << "</Piece>\n";
230  myfile << "</PolyData>\n";
231  myfile << "</VTKFile>\n";
232 
233  myfile.close();
234  }
235 }
void print_connectivity(std::ofstream &myfile) const
Definition: ERF_EBToPVD.cpp:425
void print_points(std::ofstream &myfile) const
Definition: ERF_EBToPVD.cpp:411

Referenced by eb_::WriteEBSurface().

Here is the caller graph for this function:

◆ WritePVTP()

void eb_::EBToPVD::WritePVTP ( int  nProcs)
static
238 {
239  std::ofstream myfile("eb.pvtp");
240 
241  if(myfile.is_open()) {
242  myfile << "<?xml version=\"1.0\"?>\n";
243  myfile << "<VTKFile type=\"PPolyData\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
244  myfile << "<PPolyData GhostLevel=\"0\">\n";
245  myfile << "<PPointData/>\n";
246  myfile << "<PCellData/>\n";
247  myfile << "<PPoints>\n";
248  myfile << "<PDataArray type=\"Float32\" NumberOfComponents=\"3\"/>\n";
249  myfile << "</PPoints>\n";
250 
251  for(int lc1 = 0; lc1 < nProcs; ++lc1) {
252  std::stringstream ss;
253  ss << std::setw(8) << std::setfill('0') << lc1;
254  std::string clc1 = "eb_" + ss.str() + ".vtp";
255  myfile << "<Piece Source=\"" << clc1 << "\"/>\n";
256  }
257 
258  myfile << "</PPolyData>\n";
259  myfile << "</VTKFile>\n";
260  myfile.close();
261  }
262 }

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: