AMR-Solver  1.0
Block-based Octree AMR grid flow solver
output.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <fstream>
3 #include "octree.h"
4 #include <stdlib.h>
5 #include "direction.h"
6 
7 using myOctree::Octree;
8 using myOctree::nodes;
9 
10 namespace std {
11 
14 
15  string bc;
16 
17  if(bcc==myOctree::NONE)
18  bc = "N";
19 
20  if(bcc==myOctree::BOUNDARY)
21  bc = "B";
22 
23  if(bcc==myOctree::MPI_BOUNDARY)
24  bc = "MB";
25 
26 
27  return bc;
28 }
29 
34 
35  int count = 0;
36  int blocknumber;
37  double xmin, xmax, ymin, ymax, zmin, zmax;
38  int level;
39  string eastbc, westbc, northbc, southbc, topbc, bottombc;
40  myOctree::NodeBc east_bc, west_bc, north_bc, south_bc, top_bc, bottom_bc;
41 
42 
43 
44  ofstream file ("output.pfs");
45  if(file.fail()) {
46  cerr << "Error opening input file\n";
47  exit(1);
48  }
49 
50  file << "blocks" <<endl;
51 
52  for (std::list<Octree*>::iterator it = nodes.begin(), end = nodes.end(); it != end; ++it) {
53  count++;
54 
55  xmin = (*it)->x_min;
56  ymin = (*it)->y_min;
57  zmin = (*it)->z_min;
58  xmax = (*it)->x_max;
59  ymax = (*it)->y_max;
60  zmax = (*it)->z_max;
61  level = (*it)->get_level();
62  east_bc = (*it)->bc[myOctree::XDIR][myOctree::RIGHT];
63  west_bc = (*it)->bc[myOctree::XDIR][myOctree::LEFT];
64  north_bc = (*it)->bc[myOctree::YDIR][myOctree::RIGHT];
65  south_bc = (*it)->bc[myOctree::YDIR][myOctree::LEFT];
66  top_bc = (*it)->bc[myOctree::ZDIR][myOctree::RIGHT];
67  bottom_bc = (*it)->bc[myOctree::ZDIR][myOctree::LEFT];
68 
69  blocknumber = (*it)->number;
70 
71  eastbc = NodeBc_to_string(east_bc);
72  westbc = NodeBc_to_string(west_bc);
73  northbc = NodeBc_to_string(north_bc);
74  southbc = NodeBc_to_string(south_bc);
75  topbc = NodeBc_to_string(top_bc);
76  bottombc = NodeBc_to_string(bottom_bc);
77 
78  file << blocknumber << " " << xmin << " " << xmax << " " << ymin << " " << ymax << " " << zmin << " " << zmax << " " << level<< " " ;
79  file << eastbc << " " << westbc << " " << northbc << " " << southbc << " " << topbc << " " << bottombc << endl;
80 
81  }
82 
83  file.close();
84 
85 }
86 
87 }
Standard input output stuff.
Definition: input.cpp:12
Class to store octree datastructure as nodes of the tree.
Definition: octree.h:26
std::list< Octree * > nodes
Definition: octreegrid.cpp:14
node_boundary_flags
Definition: boundary.h:7
void write_output_file()
Definition: output.cpp:33
string NodeBc_to_string(myOctree::NodeBc bcc)
Definition: output.cpp:13