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 (const int myID, const 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 (const int nProcs, const int level)
 

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
364 {
365  // default (large) value
366  std::fill(alpha.begin(), alpha.end(), 10.0);
367 
368  // Ray-xAxis intersection
369  if(std::abs(n0[0]) > std::numeric_limits<Real>::epsilon()) {
370  alpha[0] = (p - dot_product(n0,vertex[0]))/(n0[0]*dx[0]);
371  alpha[2] = (p - dot_product(n0,vertex[2]))/(n0[0]*dx[0]);
372  alpha[8] = (p - dot_product(n0,vertex[4]))/(n0[0]*dx[0]);
373  alpha[10] = (p - dot_product(n0,vertex[6]))/(n0[0]*dx[0]);
374  }
375 
376  // Ray-yAxis intersection
377  if(std::abs(n0[1]) > std::numeric_limits<Real>::epsilon()) {
378  alpha[1] = (p - dot_product(n0,vertex[1]))/(n0[1]*dx[1]);
379  alpha[3] = (p - dot_product(n0,vertex[0]))/(n0[1]*dx[1]);
380  alpha[9] = (p - dot_product(n0,vertex[5]))/(n0[1]*dx[1]);
381  alpha[11] = (p - dot_product(n0,vertex[4]))/(n0[1]*dx[1]);
382  }
383 
384  // Ray-zAxis intersection
385  if(std::abs(n0[2]) > std::numeric_limits<Real>::epsilon()) {
386  alpha[4] = (p - dot_product(n0,vertex[0]))/(n0[2]*dx[2]);
387  alpha[5] = (p - dot_product(n0,vertex[1]))/(n0[2]*dx[2]);
388  alpha[6] = (p - dot_product(n0,vertex[3]))/(n0[2]*dx[2]);
389  alpha[7] = (p - dot_product(n0,vertex[2]))/(n0[2]*dx[2]);
390  }
391 }
real(c_double), parameter epsilon
Definition: ERF_module_model_constants.F90:12

◆ 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
338 {
339  Real sign_of_dist;
340 
341  // General equation of a plane: Ax + By + Cz + D = 0
342  // here D := distance
343  distance = -dot_product(normal, centroid);
344 
345  if (std::abs(distance) > 0.) {
346  // Get the sign of the distance
347  sign_of_dist = -distance / std::abs(distance);
348 
349  // Get the Hessian form
350  Real fac = sign_of_dist/dot_product(normal, normal);
351  for(int idim = 0; idim < 3; ++idim) {
352  n0[idim] = fac*normal[idim];
353  }
354  p = sign_of_dist*(-distance);
355  } else {
356  p = 0.0;
357  }
358 }
amrex::Real Real
Definition: ERF_ShocInterface.H:16

◆ calc_intersects()

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

◆ EBGridCoverage()

void eb_::EBToPVD::EBGridCoverage ( int  myID,
const Real problo,
const Real dx,
const Box &  bx,
Array4< EBCellFlag const > const &  flag 
)
447 {
448  int lc1 = 0;
449 
450  const auto lo = lbound(bx);
451  const auto hi = ubound(bx);
452 
453  std::array<int,3> nodes = {hi.x-lo.x + 1, hi.y-lo.y + 1, hi.z-lo.z + 1};
454  std::array<int,3> low = {lo.x, lo.y, lo.z};
455 
456  for(int k = lo.z; k <= hi.z; ++k) {
457  for(int j = lo.y; j <= hi.y; ++j) {
458  for(int i = lo.x; i <= hi.x; ++i)
459  {
460  if(flag(i,j,k).isSingleValued()) {
461  lc1 = lc1 + 1;
462  }
463  }
464  }
465  };
466 
467  ++m_grid;
468  if(lc1 == 0) { return; }
469 
470  std::stringstream ss;
471  ss << std::setw(4) << std::setfill('0') << myID;
472  std::string cID = ss.str();
473 
474  ss.str("");
475  ss.clear();
476  ss << std::setw(4) << std::setfill('0') << m_grid;
477  std::string cgrid = ss.str();
478  std::string fname = "eb_grid_" + cID + "_" + cgrid + ".vtr";
479 
480  std::ofstream myfile(fname);
481  if(myfile.is_open()) {
482  myfile.precision(6);
483  myfile << "<?xml version=\"1.0\"?>\n";
484  myfile << "<VTKFile type=\"RectilinearGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
485  myfile << "<RectilinearGrid WholeExtent=\" 0 "
486  << nodes[0] << " 0 " << nodes[1] << " 0 " << nodes[2] << "\">\n";
487  myfile << "<Piece Extent=\" 0 "
488  << nodes[0] << " 0 " << nodes[1] << " 0 " << nodes[2] << "\">\n";
489  myfile << "<Coordinates>\n";
490 
491  for(int idim = 0; idim < 3; ++idim) {
492  std::vector<Real> lines(nodes[idim]+1);
493  Real grid_start = problo[idim] + static_cast<Real>(low[idim])*dx[idim];
494  for(int llc = 0; llc <= nodes[idim]; ++llc) {
495  lines[llc] = grid_start + static_cast<Real>(llc)*dx[idim];
496  }
497 
498  myfile << "<DataArray type=\"Float32\" format=\"ascii\" RangeMin=\"" // NOLINT
499  << std::fixed
500  << lines[0] << "\" RangeMax=\"" << lines[nodes[idim]] << "\">\n";
501 
502  for(auto line : lines) {
503  myfile << " " << line;
504  }
505  myfile << "\n";
506 
507  myfile << "</DataArray>\n";
508  }
509 
510  myfile << "</Coordinates>\n";
511  myfile << "</Piece>\n";
512  myfile << "</RectilinearGrid>\n";
513  myfile << "</VTKFile>\n";
514  }
515 
516  myfile.close();
517 }
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 
)
37 {
38  const auto lo = lbound(bx);
39  const auto hi = ubound(bx);
40 
41  for(int k = lo.z; k <= hi.z; ++k) {
42  for(int j = lo.y; j <= hi.y; ++j) {
43  for(int i = lo.x; i <= hi.x; ++i) {
44  // NOTE: do not skip fully enclosed cells (is_covered_cell), as this seems
45  // to skip thin walls in the domain:
46  // if(.not.is_regular_cell(flag(i,j,k)) .and. &
47  // .not.is_covered_cell(flag(i,j,k))) then
48 
49  // Instead only look for EBs
50  // if( .not.is_regular_cell(flag(i,j,k))) then
51 
52  // If covered cells are accounted for in this loop, a FPE arises
53  // since apnorm is zero.
54 
55  if(flag(i,j,k).isSingleValued()) {
56 
57  // Boundary normal vector
58 
59  Real axm = apx(i ,j ,k );
60  Real axp = apx(i+1,j ,k );
61  Real aym = apy(i ,j ,k );
62  Real ayp = apy(i ,j+1,k );
63  Real azm = apz(i ,j ,k );
64  Real azp = apz(i ,j ,k+1);
65 
66  Real adx = (axm-axp) * dx[1] * dx[2];
67  Real ady = (aym-ayp) * dx[0] * dx[2];
68  Real adz = (azm-azp) * dx[0] * dx[1];
69 
70  Real apnorm = std::sqrt(adx*adx + ady*ady + adz*adz);
71  Real apnorminv = Real(1.0)/apnorm;
72 
73  std::array<Real,3> normal, centroid;
74  std::array<std::array<Real,3>,8> vertex;
75 
76  normal[0] = adx * apnorminv;
77  normal[1] = ady * apnorminv;
78  normal[2] = adz * apnorminv;
79 
80  // convert bcent to global coordinate system centered at plo
81 
82  centroid[0] = problo[0] + bcent(i,j,k,0)*dx[0] + (static_cast<Real>(i) + Real(0.5))*dx[0];
83  centroid[1] = problo[1] + bcent(i,j,k,1)*dx[1] + (static_cast<Real>(j) + Real(0.5))*dx[1];
84  centroid[2] = problo[2] + bcent(i,j,k,2)*dx[2] + (static_cast<Real>(k) + Real(0.5))*dx[2];
85 
86  // vertices of bounding cell (i,j,k)
87  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]};
88  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]};
89  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]};
90  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]};
91  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]};
92  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]};
93  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]};
94  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]};
95 
96  // NOTE: this seems to be unnecessary:
97  // skip cells that have a tiny intersection and cells that have
98  // the centroid on a face/edge/corner
99  // if(apnorm > stol .and. &
100  // vertex(1,1) < centroid(1) .and. centroid(1) < vertex(8,1) .and. &
101  // vertex(1,2) < centroid(2) .and. centroid(2) < vertex(8,2) .and. &
102  // vertex(1,3) < centroid(3) .and. centroid(3) < vertex(8,3)) then
103 
104  // Compute EB facets for current cell
105  int count;
106  Real distance, p;
107  std::array<Real,3> n0;
108  std::array<Real,12> alpha;
109  std::array<bool,12> alpha_intersect;
110 
111  calc_hesse(distance, n0, p, normal, centroid);
112  calc_alpha(alpha, n0, p, vertex, dx);
113  calc_intersects(count, alpha_intersect, alpha);
114 
115  // If the number of facet "contained" in does not describe a facet:
116  // ... I.e. there's less than 3 (not even a triangle) or more than 6
117  // ... (I have no idea what that is):
118  // => Move the centroid a little back and forth along the normal
119  // to see if that makes a difference:
120 
121  if((count < 3) || (count > 6)) {
122  int count_d;
123  Real p_d;
124  std::array<Real,3> n0_d;
125  std::array<Real,12> alpha_d;
126  std::array<bool,12> alpha_d_intersect;
127 
128  Real tol = std::min({dx[0], dx[1], dx[2]})/Real(100.); // bit of a fudge factor
129 
130  std::array<Real,3> centroid_d;
131  for(int idim = 0; idim < 3; ++idim) {
132  centroid_d[idim] = centroid[idim] + tol*normal[idim];
133  }
134 
135  calc_hesse(distance, n0_d, p_d, normal, centroid_d);
136  calc_alpha(alpha_d, n0_d, p_d, vertex, dx);
137  calc_intersects(count_d, alpha_d_intersect, alpha_d);
138  if((count_d >= 3) && (count_d <= 6)) {
139  count = count_d;
140  alpha_intersect = alpha_d_intersect;
141  }
142 
143  for(int idim = 0; idim < 3; ++idim) {
144  centroid_d[idim] = centroid[idim] - tol*normal[idim];
145  }
146 
147  calc_hesse(distance, n0_d, p_d, normal, centroid_d);
148  calc_alpha(alpha_d, n0_d, p_d, vertex, dx);
149  calc_intersects(count_d, alpha_d_intersect, alpha_d);
150  if((count_d >= 3) && (count_d <= 6)) {
151  count = count_d;
152  alpha_intersect = alpha_d_intersect;
153  }
154  }
155  // I know this was a bit of a hack, but it's the only way I prevent
156  // missing facets...
157 
158  if((count >=3) && (count <=6)) {
159  m_connectivity.push_back({0,0,0,0,0,0,0});
160 
161  // calculate intersection points.
162  std::array<std::array<Real,3>,12> a_points;
163 
164  std::array<Real,3> ihat = {1, 0, 0};
165  std::array<Real,3> jhat = {0, 1, 0};
166  std::array<Real,3> khat = {0, 0, 1};
167 
168  for(int idim = 0; idim < 3; ++idim) {
169  a_points[ 0][idim] = vertex[0][idim] + ihat[idim]*dx[0]*alpha[ 0];
170  a_points[ 1][idim] = vertex[1][idim] + jhat[idim]*dx[1]*alpha[ 1];
171  a_points[ 2][idim] = vertex[2][idim] + ihat[idim]*dx[0]*alpha[ 2];
172  a_points[ 3][idim] = vertex[0][idim] + jhat[idim]*dx[1]*alpha[ 3];
173  a_points[ 4][idim] = vertex[0][idim] + khat[idim]*dx[2]*alpha[ 4];
174  a_points[ 5][idim] = vertex[1][idim] + khat[idim]*dx[2]*alpha[ 5];
175  a_points[ 6][idim] = vertex[3][idim] + khat[idim]*dx[2]*alpha[ 6];
176  a_points[ 7][idim] = vertex[2][idim] + khat[idim]*dx[2]*alpha[ 7];
177  a_points[ 8][idim] = vertex[4][idim] + ihat[idim]*dx[0]*alpha[ 8];
178  a_points[ 9][idim] = vertex[5][idim] + jhat[idim]*dx[1]*alpha[ 9];
179  a_points[10][idim] = vertex[6][idim] + ihat[idim]*dx[0]*alpha[10];
180  a_points[11][idim] = vertex[4][idim] + jhat[idim]*dx[1]*alpha[11];
181  }
182 
183  // store intersections with grid cell alpha in [0,1]
184  for(int lc1 = 0; lc1 < 12; ++lc1) {
185  if(alpha_intersect[lc1]) {
186  m_points.push_back(a_points[lc1]);
187  int lc2 = m_connectivity.back()[0]+1;
188  m_connectivity.back()[0] = lc2;
189  m_connectivity.back()[lc2] = static_cast<int>(m_points.size()-1);
190  }
191  }
192 
194  }
195  }
196  }
197  }
198  };
199 }
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:393
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:255
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:360
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:336

Referenced by eb_::WriteEBSurface().

Here is the caller graph for this function:

◆ print_connectivity()

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

◆ print_grids()

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

◆ print_points()

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

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

◆ WriteEBVTP()

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

Referenced by eb_::WriteEBSurface().

Here is the caller graph for this function:

◆ WritePVTP()

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

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: