3 namespace GridConversion{
namespace DriverProgram{
5 int SerialProgram::ReadInput(){
7 std::ostringstream Ostr;
14 std::ostringstream ErrOstr;
15 ErrOstr <<
"Could not open input file, '"
19 ErrOut(ErrOstr.str());
34 std::getline(
Inf,line);
35 std::getline(
Inf,line);
36 std::getline(
Inf,line);
39 std::getline(
Inf,line);
46 Ostr <<
"Number of nodes = " <<
numNodes << std::endl;
47 Ostr <<
"Number of elements = " << numElems << std::endl;
51 std::getline(
Inf,line);
52 std::getline(
Inf,line);
57 std::getline(
Inf,line);
61 std::getline(
Inf,line);
65 ss >> valueI >> valueI >> valueI;
68 if(valueI <= 1 || valueI == 6 || valueI > 9){
69 std::ostringstream ErrOstr;
70 ErrOstr <<
"element shape value of " << valueI <<
" is invalid." << std::endl
71 <<
"Valid shape values:" << std::endl
72 <<
" 2: bar" << std::endl
73 <<
" 3: triangle" << std::endl
74 <<
" 4: quadrilateral" << std::endl
75 <<
" 5: tetrahedron" << std::endl
76 <<
" 7: triangular prism" << std::endl
77 <<
" 8: hexahedron" << std::endl
78 <<
" 9: pyramid" << std::endl;
81 ErrOut(ErrOstr.str());
97 std::ostringstream ErrOstr;
98 ErrOstr <<
"Meshes must have only one element shape!" << std::endl
99 <<
"Element " <<
i <<
" has shape value " << valueI <<
" but "
100 <<
"previous elements have shape value " <<
elemShape << std::endl;
103 ErrOut(ErrOstr.str());
109 std::getline(
Inf,line);
116 if(valueI < 2 || valueI == 7 || valueI == 9 || valueI > 10){
117 std::ostringstream ErrOstr;
118 ErrOstr <<
"Error: " << valueI <<
" number of nodes per element is invalid." << std::endl
119 <<
"Valid number of nodes:" << std::endl
120 <<
" 2: bar" << std::endl
121 <<
" 3: triangle" << std::endl
122 <<
" 4: quadrilateral or tetrahedron" << std::endl
123 <<
" 5: pyramid" << std::endl
124 <<
" 6: triangular prism" << std::endl
125 <<
" 8: hexahedron" << std::endl
126 <<
" 10: tehtrahedron (higher order)" << std::endl;
129 ErrOut(ErrOstr.str());
141 Ostr <<
"Number of nodes per element " <<
numNodesPerElem <<
"." << std::endl;
145 std::ostringstream ErrOstr;
146 ErrOstr <<
"Meshes must have elements with the same number of nodes!" << std::endl
147 <<
"Element " <<
i <<
" has " << valueI <<
" nodes but "
148 <<
"previous elements have " <<
numNodesPerElem <<
" nodes." << std::endl;
151 ErrOut(ErrOstr.str());
161 std::getline(
Inf,line);
166 ss >>
elems[
i*numNodesPerElem +
j];
171 while(getline(
Inf,line)){
172 int packet,
lines=0, domainNodes;
173 std::vector<unsigned int> oneDomain;
178 ss >> packet >> valueI >> domainNodes >>
lines;
183 std::getline(
Inf,line);
184 for(
int i=0;
i < lines-1;
i++){
185 std::getline(
Inf,line);
192 oneDomain.push_back(valueI);
207 std::ostringstream ErrOstr;
208 ErrOstr <<
"Could not open input file, '"
212 ErrOut(ErrOstr.str());
222 while(std::getline(
Inf,line)){
223 int numFlags=0, domainNum;
224 std::string edgeOrDomain;
229 ss >> edgeOrDomain >> domainNum;
231 std::cout <<
"edgeOrDomain = " << edgeOrDomain << std::endl;
233 if(edgeOrDomain ==
"edge" || edgeOrDomain ==
"Edge"
234 || edgeOrDomain ==
"EDGE"){
237 edges[domainNum].push_back(valueI);
239 edges[domainNum].push_back(valueI);
242 else if(edgeOrDomain ==
"edges" || edgeOrDomain ==
"Edges"
243 || edgeOrDomain ==
"EDGES"){
244 edges.resize(domainNum+1);
250 else if(edgeOrDomain !=
"domain" && edgeOrDomain !=
"Domain"
251 && edgeOrDomain !=
"DOMAIN"){
252 std::ostringstream ErrOstr;
253 ErrOstr <<
"First word of every line in bc file must be 'domain,'"
254 << std::endl <<
"'edge', or 'edges.'" << std::endl;
257 ErrOut(ErrOstr.str());
265 std::cout <<
"edges.size() = " <<
edges.size() << std::endl;
266 std::cout <<
"edgeBCs.size() = " <<
edgeBCs.size() << std::endl;
267 std::cout <<
"edgeBCValues.size() = " <<
edgeBCValues.size() << std::endl;
268 std::cout <<
"domainNum = " << domainNum << std::endl;
275 for(
int j=0; j < numFlags; j++){
280 edgeBCs[domainNum].push_back(valueI);
283 for(
int i=0;
i < 6;
i++){
291 else if(valueI == 6){
300 std::ostringstream ErrOstr;
301 ErrOstr <<
"Invalid boundary condition type of " << valueI
302 <<
" for boundary " <<
domainBCs.size() <<
"." << std::endl;
305 ErrOut(ErrOstr.str());
std::vector< std::vector< unsigned int > > domains
vector of vectors to hold the domains
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 > > edgeBCs
vector to hold list of edge bc flags
C by Argonne National Laboratory and Mississipi State University!All rights reserved See COPYRIGHT in top level directory!user include file for MPI with no dependencies!It really is not possible to make a perfect include file that can!be used by both F77 and F90 but this is close We have removed!continuation lines(allows free form input in F90)
int verblevel
Verbosity level.
std::vector< std::string > shapes
vector to hold the element shapes (only used for Patran input format)
int numNodesPerElem
number of nodes per element
std::vector< std::vector< int > > domainBCs
vector to hold list of domain bc flags
std::ifstream Inf
Infile stream for input.
std::vector< std::vector< int > > edges
vector of vectors to hold the edges
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...
std::vector< std::vector< std::vector< double > > > edgeBCValues
vector to hold list of edge bc values (these are different for each bc type - see the Rocfrac documen...
int elemShape
integer to denote the shape of elements used in the mesh
int numNodes
number of nodes in mesh
std::string bc_input_name
Name of bc input file.
std::string input_name
Name of input file.
std::vector< double > nodes
vector for holding nodal coordinates read from input