4 namespace GridConversion{
namespace DriverProgram{
8 std::ostringstream Ostr;
13 bool use_outfile =
false;
20 std::ostringstream ErrOstr;
21 ErrOstr <<
"Error: Unable to open output file, " <<
output_name <<
".";
24 ErrOut(ErrOstr.str());
38 ss <<
"unused line" << std::endl;
39 ss <<
"unused line" << std::endl;
42 ss <<
"unused line" << std::endl;
44 unsigned int ePos, expPos;
45 std::stringstream numSS;
46 std::string output, exponent;
49 ss <<
"1 " <<
i+1 << std::endl;
52 numSS << std::setprecision(9) << std::scientific <<
nodes[3*
i + 0];
53 ePos = numSS.str().find(
"e");
54 expPos = numSS.str().find_last_of(
"0");
58 if(expPos == numSS.str().size()-1)
61 exponent = numSS.str().substr(expPos+1,numSS.str().size());
62 output = numSS.str().substr(0,ePos+2) + exponent;
68 numSS << std::setprecision(8) << std::scientific <<
nodes[3*
i + 0];
70 numSS << std::setprecision(9) << std::scientific << nodes[3*
i + 0];
74 ss << std::setw(16) << output;
79 numSS << std::setprecision(9) << std::scientific <<
nodes[3*
i + 1];
80 ePos = numSS.str().find(
"e");
81 expPos = numSS.str().find_last_of(
"0");
85 if(expPos == numSS.str().size()-1)
88 exponent = numSS.str().substr(expPos+1,numSS.str().size());
89 output = numSS.str().substr(0,ePos+2) + exponent;
95 numSS << std::setprecision(8) << std::scientific <<
nodes[3*
i + 1];
97 numSS << std::setprecision(9) << std::scientific << nodes[3*
i + 1];
101 ss << std::setw(16) << output;
105 if(fabs(
nodes[3*
i+2]) > 1.0e-10 ||
nodes[3*
i+2] == 0.0){
106 numSS << std::setprecision(9) << std::scientific <<
nodes[3*
i + 2];
107 ePos = numSS.str().find(
"e");
108 expPos = numSS.str().find_last_of(
"0");
112 if(expPos == numSS.str().size()-1)
115 exponent = numSS.str().substr(expPos+1,numSS.str().size());
116 output = numSS.str().substr(0,ePos+2) + exponent;
122 numSS << std::setprecision(8) << std::scientific <<
nodes[3*
i + 2];
124 numSS << std::setprecision(9) << std::scientific << nodes[3*
i + 2];
126 output = numSS.str();
128 ss << std::setw(16) << output << std::endl;
132 ss <<
"unused line" << std::endl;
137 ss <<
"2 " <<
i+1 <<
" " <<
elemShape << std::endl
139 <<
" 0" << std::endl;
141 ss <<
elems[
i*numNodesPerElem +
j] <<
" ";
150 ss <<
"8 " <<
i+1 <<
" 1 2" << std::endl;
152 for(
int j=0;
j < 3;
j++)
154 ss <<
"000" << std::endl;
155 for(
int j=3; j < 6; j++){
180 ss <<
"6 " <<
i+1 <<
" 1 2 0 0 0 0 0" << std::endl;
188 for(
int l=0; l <
nodeBCs[node].size(); l++){
205 for(domCount=0; domCount <
nodesToDomains[node].size(); domCount++){
219 if(numNodesPerElem == 4)
virtual int WriteOutput()
This function writes the output grid file.
GridConversion interface.
std::vector< unsigned int > elems
vector for holding element connectivies read from input
int numElems
number of elements in mesh
std::vector< std::vector< int > > elemsToDomains
vector to hold the domains for each element
std::vector< std::vector< int > > nodeBCs
std::string output_name
Name of file for output.
SolverUtils::Mesh::Connectivity nodesToDomains
std::ofstream Ouf
Outfile stream for output.
int numNodesPerElem
number of nodes per element
std::vector< std::vector< int > > domainBCs
vector to hold list of domain bc flags
std::vector< std::vector< std::vector< double > > > domainBCValues
vector to hold list of domain bc values (these are different for each bc type - see the Rocfrac docum...
int elemShape
integer to denote the shape of elements used in the mesh
int numNodes
number of nodes in mesh
std::vector< double > nodes
vector for holding nodal coordinates read from input
std::vector< std::vector< std::vector< double > > > nodeBCValues
vector to hold list of node bc values (these are different for each bc type - see the Rocfrac documen...