3 namespace GridConversion{
namespace DriverProgram{
7 FunctionEntry(
"ReadStanfordInput");
8 std::ostringstream Ostr;
15 std::ostringstream ErrOstr;
16 ErrOstr <<
"Could not open input file, '"
20 ErrOut(ErrOstr.str());
24 FunctionExit(
"ReadStanfordInput");
35 for(
int i=0;
i < 8;
i++)
36 std::getline(
Inf,line);
44 Ostr <<
"Number of nodes = " <<
numNodes << std::endl;
45 Ostr <<
"Number of elements = " << numElems << std::endl;
48 std::getline(
Inf,line);
61 Ostr <<
"Element shape value: " <<
elemShape << std::endl;
67 std::ostringstream ErrOstr;
68 ErrOstr <<
"For Stanford format input only element shapes " << std::endl
69 <<
"10 and 12 are supported! Input file has shape "
73 ErrOut(ErrOstr.str());
80 std::ostringstream ErrOstr;
81 ErrOstr <<
"Meshes must have only one element shape!" << std::endl
82 <<
"Element " <<
i <<
" has shape value " << valueI <<
" but "
83 <<
"previous elements have shape value " <<
elemShape << std::endl;
86 ErrOut(ErrOstr.str());
97 elems.push_back(valueI);
101 for(
int i=0;
i < 4;
i++)
102 std::getline(
Inf,line);
109 nodes.resize(3*numNodes);
113 Ostr <<
"Number of nodes = " << numNodes << std::endl;
114 Ostr <<
"Number of elements = " << numElems << std::endl;
118 std::getline(
Inf,line);
127 for(
int i=0;
i < 4;
i++)
137 int packet,
lines=0, domainNodes;
138 std::vector<unsigned int> oneDomain;
139 int numNodesPerFaceElem;
147 ss >> valueS >>
lines;
158 numNodesPerFaceElem = 4;
160 numNodesPerFaceElem = 3;
162 std::ostringstream ErrOstr;
163 ErrOstr <<
"Face elements must be of type 9 (quad) or 5 (tri)!" << std::endl
164 <<
"Face type " << valueI <<
" was read!" << std::endl;
167 ErrOut(ErrOstr.str());
173 for(
int k=0;
k < numNodesPerFaceElem;
k++){
180 for(
int l=0; l < oneDomain.size(); l++){
181 if(oneDomain[l] == valueI){
188 oneDomain.push_back(valueI);
204 std::ostringstream ErrOstr;
205 ErrOstr <<
"Could not open input file, '"
209 ErrOut(ErrOstr.str());
213 FunctionExit(
"ReadStanfordInput");
219 while(std::getline(
Inf,line)){
220 int numFlags=0, domainNum;
221 std::string edgeOrDomain;
226 ss >> edgeOrDomain >> domainNum;
231 if(edgeOrDomain ==
"edge" || edgeOrDomain ==
"Edge"
232 || edgeOrDomain ==
"EDGE"){
235 edges[domainNum].push_back(valueI);
237 edges[domainNum].push_back(valueI);
240 else if(edgeOrDomain ==
"edges" || edgeOrDomain ==
"Edges"
241 || edgeOrDomain ==
"EDGES"){
242 edges.resize(domainNum+1);
248 else if(edgeOrDomain !=
"domain" && edgeOrDomain !=
"Domain"
249 && edgeOrDomain !=
"DOMAIN"){
250 std::ostringstream ErrOstr;
251 ErrOstr <<
"First word of every line in bc file must be 'domain,'"
252 << std::endl <<
"'edge', or 'edges.'" << std::endl;
255 ErrOut(ErrOstr.str());
259 FunctionExit(
"ReadStanfordInput");
270 for(
int j=0;
j < numFlags;
j++){
276 edgeBCs[domainNum].push_back(valueI);
280 for(
int i=0;
i < 7;
i++){
289 else if(valueI == 6){
299 std::ostringstream ErrOstr;
300 ErrOstr <<
"Invalid boundary condition type of " << valueI
301 <<
" for boundary " <<
domainBCs.size() <<
"." << std::endl;
304 ErrOut(ErrOstr.str());
308 FunctionExit(
"ReadStanfordInput");
321 FunctionExit(
"ReadStanfordInput");
std::vector< std::vector< unsigned int > > domains
vector of vectors to hold the domains
int numDomains
number of domains in mesh
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.
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.
virtual int ReadStanfordInput()
This function parses a Stanford format input file.
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