3 namespace GridConversion{
namespace DriverProgram{
7 std::ostringstream Ostr;
9 FunctionEntry(
"ReadPatranInput");
15 std::ostringstream ErrOstr;
16 ErrOstr <<
"Could not open input file, '"
20 ErrOut(ErrOstr.str());
24 FunctionExit(
"ReadPatranInput");
35 std::getline(
Inf,line);
36 std::getline(
Inf,line);
37 std::getline(
Inf,line);
40 std::getline(
Inf,line);
47 Ostr <<
"Number of nodes = " <<
numNodes << std::endl;
48 Ostr <<
"Number of elements = " << numElems << std::endl;
52 std::getline(
Inf,line);
53 std::getline(
Inf,line);
58 std::getline(
Inf,line);
62 std::getline(
Inf,line);
66 ss >> valueI >> valueI >> valueI;
69 if(valueI <= 1 || valueI == 6 || valueI > 9){
70 std::ostringstream ErrOstr;
71 ErrOstr <<
"element shape value of " << valueI <<
" is invalid." << std::endl
72 <<
"Valid shape values:" << std::endl
73 <<
" 2: bar" << std::endl
74 <<
" 3: triangle" << std::endl
75 <<
" 4: quadrilateral" << std::endl
76 <<
" 5: tetrahedron" << std::endl
77 <<
" 7: triangular prism" << std::endl
78 <<
" 8: hexahedron" << std::endl
79 <<
" 9: pyramid" << std::endl;
82 ErrOut(ErrOstr.str());
98 std::ostringstream ErrOstr;
99 ErrOstr <<
"Meshes must have only one element shape!" << std::endl
100 <<
"Element " <<
i <<
" has shape value " << valueI <<
" but "
101 <<
"previous elements have shape value " <<
elemShape << std::endl;
104 ErrOut(ErrOstr.str());
110 std::getline(
Inf,line);
117 if(valueI < 2 || valueI == 7 || valueI == 9 || valueI > 10){
118 std::ostringstream ErrOstr;
119 ErrOstr <<
"Error: " << valueI <<
" number of nodes per element is invalid." << std::endl
120 <<
"Valid number of nodes:" << std::endl
121 <<
" 2: bar" << std::endl
122 <<
" 3: triangle" << std::endl
123 <<
" 4: quadrilateral or tetrahedron" << std::endl
124 <<
" 5: pyramid" << std::endl
125 <<
" 6: triangular prism" << std::endl
126 <<
" 8: hexahedron" << std::endl
127 <<
" 10: tehtrahedron (higher order)" << std::endl;
130 ErrOut(ErrOstr.str());
142 Ostr <<
"Number of nodes per element " <<
numNodesPerElem <<
"." << std::endl;
146 std::ostringstream ErrOstr;
147 ErrOstr <<
"Meshes must have elements with the same number of nodes!" << std::endl
148 <<
"Element " <<
i <<
" has " << valueI <<
" nodes but "
149 <<
"previous elements have " <<
numNodesPerElem <<
" nodes." << std::endl;
152 ErrOut(ErrOstr.str());
162 std::getline(
Inf,line);
167 ss >>
elems[
i*numNodesPerElem +
j];
172 while(getline(
Inf,line)){
173 int packet,
lines=0, domainNodes;
174 std::vector<unsigned int> oneDomain;
179 ss >> packet >> valueI >> domainNodes >>
lines;
184 std::getline(
Inf,line);
185 for(
int i=0;
i < lines-1;
i++){
186 std::getline(
Inf,line);
193 oneDomain.push_back(valueI);
208 std::ostringstream ErrOstr;
209 ErrOstr <<
"Could not open input file, '"
213 ErrOut(ErrOstr.str());
217 FunctionExit(
"ReadPatranInput");
223 while(std::getline(
Inf,line)){
224 int numFlags=0, domainNum;
225 std::string edgeOrDomain;
230 ss >> edgeOrDomain >> domainNum;
232 std::cout <<
"edgeOrDomain = " << edgeOrDomain << std::endl;
234 if(edgeOrDomain ==
"edge" || edgeOrDomain ==
"Edge"
235 || edgeOrDomain ==
"EDGE"){
238 edges[domainNum].push_back(valueI);
240 edges[domainNum].push_back(valueI);
243 else if(edgeOrDomain ==
"edges" || edgeOrDomain ==
"Edges"
244 || edgeOrDomain ==
"EDGES"){
245 edges.resize(domainNum+1);
251 else if(edgeOrDomain !=
"domain" && edgeOrDomain !=
"Domain"
252 && edgeOrDomain !=
"DOMAIN"){
253 std::ostringstream ErrOstr;
254 ErrOstr <<
"First word of every line in bc file must be 'domain,'"
255 << std::endl <<
"'edge', or 'edges.'" << std::endl;
258 ErrOut(ErrOstr.str());
262 FunctionExit(
"ReadPatranInput");
266 std::cout <<
"edges.size() = " <<
edges.size() << std::endl;
267 std::cout <<
"edgeBCs.size() = " <<
edgeBCs.size() << std::endl;
268 std::cout <<
"edgeBCValues.size() = " <<
edgeBCValues.size() << std::endl;
269 std::cout <<
"domainNum = " << domainNum << std::endl;
276 std::cout <<
"line " << __LINE__ << std::endl;
278 for(
int j=0;
j < numFlags;
j++){
283 edgeBCs[domainNum].push_back(valueI);
285 std::cout <<
"line " << __LINE__ << std::endl;
287 for(
int i=0;
i < 6;
i++){
295 else if(valueI == 6){
304 std::ostringstream ErrOstr;
305 ErrOstr <<
"Invalid boundary condition type of " << valueI
306 <<
" for boundary " <<
domainBCs.size() <<
"." << std::endl;
309 ErrOut(ErrOstr.str());
313 FunctionExit(
"ReadPatranInput");
316 std::cout <<
"line " << __LINE__ << std::endl;
320 std::cout <<
"line " << __LINE__ << std::endl;
326 FunctionExit(
"ReadPatranInput");
std::vector< std::vector< unsigned int > > domains
vector of vectors to hold the domains
virtual int ReadPatranInput()
This function parses a Patran format input 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 > > 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