51                                                "Reads Semtex session files.");
 
   84         cout << 
"InputSem: Start reading file..." << endl;
 
  113             if (word == 
"<" + it->first || word == 
"<" + it->first + 
">")
 
  125     if (
sectionMap[
"NODES"] == std::streampos(-1))
 
  127         cerr << 
"Unable to locate NODES section in session file." << endl;
 
  131     if (
sectionMap[
"ELEMENTS"] == std::streampos(-1))
 
  133         cerr << 
"Unable to locate ELEMENTS section in session file." << endl;
 
  137     if (
sectionMap[
"SURFACES"] != std::streampos(-1))
 
  141             cerr << 
"SURFACES section defined but BCS section not " 
  146         if (
sectionMap[
"GROUPS"] == std::streampos(-1))
 
  148             cerr << 
"SURFACES section defined but GROUPS section not " 
  153         if (
sectionMap[
"FIELDS"] == std::streampos(-1))
 
  155             cerr << 
"SURFACES section defined but FIELDS section not " 
  163     int start, end, nVertices, nEntities, nCurves, nSurf, nGroups, nBCs;
 
  165     vector<double> hoXData, hoYData;
 
  178     start     = tag.find_first_of(
'=');
 
  179     end       = tag.find_first_of(
'>');
 
  180     nVertices = atoi(tag.substr(start + 1, end).c_str());
 
  183     while (i < nVertices)
 
  186         if (line.length() < 7)
 
  190         double x = 0, y = 0, z = 0;
 
  191         ss >> 
id >> x >> y >> z;
 
  193         if ((y * y) > 0.000001 && 
m_mesh->m_spaceDim != 3)
 
  197         if ((z * z) > 0.000001)
 
  203             boost::shared_ptr<Node>(
new Node(
id, x, y, z)));
 
  215     start     = tag.find_first_of(
'=');
 
  216     end       = tag.find_first_of(
'>');
 
  217     nEntities = atoi(tag.substr(start + 1, end).c_str());
 
  220     while (i < nEntities)
 
  223         if (line.length() < 18)
 
  236         vector<NodeSharedPtr> nodeList;
 
  237         for (j = 0; j < 4; ++j)
 
  241             nodeList.push_back(
m_mesh->m_node[node - 1]);
 
  250         if (E->GetDim() > 
m_mesh->m_expDim)
 
  252             m_mesh->m_expDim = E->GetDim();
 
  254         m_mesh->m_element[E->GetDim()].push_back(E);
 
  259     if (
sectionMap[
"CURVES"] != std::streampos(-1))
 
  261         int np, nel, nodeId = 
m_mesh->m_node.size();
 
  270         start   = tag.find_first_of(
'=');
 
  271         end     = tag.find_first_of(
'>');
 
  272         nCurves = atoi(tag.substr(start + 1, end).c_str());
 
  278             string fname    = 
m_config[
"infile"].as<
string>();
 
  279             int ext         = fname.find_last_of(
'.');
 
  280             string meshfile = fname.substr(0, ext) + 
".msh";
 
  282             homeshFile.open(meshfile.c_str());
 
  283             if (!homeshFile.is_open())
 
  285                 cerr << 
"Cannot open or find mesh file: " << meshfile << endl
 
  286                      << 
"Make sure to run meshpr on your session " 
  287                      << 
"file first." << endl;
 
  292             getline(homeshFile, line);
 
  295             ss >> np >> nel >> nel >> nel;
 
  299                 cerr << 
"Number of elements mismatch in mesh file." << endl;
 
  306             hoXData.resize(nel * np * np);
 
  307             hoYData.resize(nel * np * np);
 
  309             for (j = 0; j < nel * np * np; ++j)
 
  311                 getline(homeshFile, line);
 
  314                 ss >> hoXData[j] >> hoYData[j];
 
  324             if (line.length() < 18)
 
  328             int elmt = 0, side = 0;
 
  331             ss >> 
id >> elmt >> side >> word;
 
  335             vector<NodeSharedPtr> edgeNodes;
 
  337             if (word != 
"<SPLINE>" && word != 
"<ARC>")
 
  339                 cerr << 
"Unknown curve tag: " << word << endl;
 
  346             if (
m_mesh->m_element[2][elmt]->GetConf().m_order > 1)
 
  353             for (
int side = 0; side < 4; ++side)
 
  355                 int offset = elmt * np * np;
 
  369                         offset += np * np - 1;
 
  373                         offset += np * (np - 1);
 
  377                         cerr << 
"Unknown side for curve id " << 
id << endl;
 
  381                 for (j = 1; j < np - 1; ++j, ++nodeId)
 
  383                     double x = hoXData[offset + j * stride];
 
  384                     double y = hoYData[offset + j * stride];
 
  386                         boost::shared_ptr<Node>(
new Node(nodeId, x, y, 0.0));
 
  387                     edgeNodes.push_back(n);
 
  392             for (j = 1; j < np - 1; ++j)
 
  394                 int offset = j * np + 1;
 
  395                 for (k = 1; k < np - 1; ++k, ++nodeId)
 
  397                     double x = hoXData[offset + k];
 
  398                     double y = hoYData[offset + k];
 
  400                         boost::shared_ptr<Node>(
new Node(nodeId, x, y, 0.0));
 
  401                     edgeNodes.push_back(n);
 
  408             vector<NodeSharedPtr> elvert = e->GetVertexList();
 
  409             vector<int> tags = e->GetTagList();
 
  410             edgeNodes.insert(edgeNodes.begin(), elvert.begin(), elvert.end());
 
  421                 elType, conf, edgeNodes, tags);
 
  428     if (
sectionMap[
"FIELDS"] != std::streampos(-1))
 
  438             m_mesh->m_fields.push_back(tag);
 
  444     if (
sectionMap[
"SURFACES"] != std::streampos(-1))
 
  446         map<string, int> conditionMap;
 
  457         start   = tag.find_first_of(
'=');
 
  458         end     = tag.find_first_of(
'>');
 
  459         nGroups = atoi(tag.substr(start + 1, end).c_str());
 
  468             conditionMap[tag] = i++;
 
  482         start = tag.find_first_of(
'=');
 
  483         end   = tag.find_first_of(
'>');
 
  484         nBCs  = atoi(tag.substr(start + 1, end).c_str());
 
  495             ss >> 
id >> tag >> nF;
 
  498             m_mesh->m_condition[conditionMap[tag]] = p;
 
  514                 else if (tmp == 
"<N>")
 
  518                 else if (tmp == 
"<H>")
 
  521                     p->value.push_back(
"0");
 
  522                     p->field.push_back(
"p");
 
  528                     cerr << 
"Unsupported boundary condition type " << tmp
 
  535                 p->field.push_back(tmp);
 
  541                     cerr << 
"Couldn't read boundary condition type " << tag
 
  549                 p->value.push_back(tmp);
 
  557             p->m_composite.push_back(conditionMap[tag] + 1);
 
  570         start = tag.find_first_of(
'=');
 
  571         end   = tag.find_first_of(
'>');
 
  572         nSurf = atoi(tag.substr(start + 1, end).c_str());
 
  576         int periodicTagId = -1;
 
  578         set<pair<int, int> > visitedPeriodic;
 
  585             ss >> 
id >> elmt >> side >> word;
 
  594                 if (periodicTagId == -1)
 
  596                     periodicTagId         = maxTag;
 
  600                     for (j = 0; j < 
m_mesh->m_fields.size(); ++j)
 
  604                         in->field.push_back(
m_mesh->m_fields[j]);
 
  605                         out->field.push_back(
m_mesh->m_fields[j]);
 
  606                         in->value.push_back(
"[" + boost::lexical_cast<string>(
 
  609                         out->value.push_back(
 
  610                             "[" + boost::lexical_cast<string>(periodicTagId) +
 
  613                     in->m_composite.push_back(periodicTagId + 1);
 
  614                     out->m_composite.push_back(periodicTagId + 2);
 
  615                     m_mesh->m_condition[periodicTagId]     = in;
 
  616                     m_mesh->m_condition[periodicTagId + 1] = out;
 
  621                 ss >> elmtB >> sideB;
 
  625                 pair<int, int> c1(elmt, side);
 
  626                 pair<int, int> c2(elmtB, sideB);
 
  628                 if (visitedPeriodic.count(c1) == 0 &&
 
  629                     visitedPeriodic.count(c2) == 0)
 
  631                     visitedPeriodic.insert(make_pair(elmtB, sideB));
 
  632                     visitedPeriodic.insert(make_pair(elmt, side));
 
  637             else if (word == 
"<B>")
 
  640                 insertEdge(elmt, side, conditionMap[tag] + 1);
 
  644                 cerr << 
"Unrecognised or unsupported tag " << word << endl;
 
  665     vector<NodeSharedPtr> edgeNodes = edge->m_edgeNodes;
 
  666     edgeNodes.insert(edgeNodes.begin(), edge->m_n2);
 
  667     edgeNodes.insert(edgeNodes.begin(), edge->m_n1);
 
  668     int order = edgeNodes.size() - 1;
 
  671     tags.push_back(tagId);
 
  681     m_mesh->m_element[1].push_back(E);
 
Defines a boundary condition. 
 
Basic information about an element. 
 
pair< ModuleType, string > ModuleKey
 
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey. 
 
map< string, ConfigOption > m_config
List of configuration values. 
 
MeshSharedPtr m_mesh
Mesh object. 
 
ElementFactory & GetElementFactory()
 
Represents a point in the domain. 
 
virtual void ProcessEdges(bool ReprocessEdges=true)
Extract element edges. 
 
virtual void ProcessVertices()
Extract element vertices. 
 
virtual void ProcessElements()
Generate element IDs. 
 
boost::shared_ptr< Node > NodeSharedPtr
 
boost::shared_ptr< Condition > ConditionSharedPtr
 
virtual void ProcessComposites()
Generate composites. 
 
boost::shared_ptr< Edge > EdgeSharedPtr
Shared pointer to an edge. 
 
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
 
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh. 
 
virtual void ProcessFaces(bool ReprocessFaces=true)
Extract element faces. 
 
boost::shared_ptr< Element > ElementSharedPtr
 
1D Gauss-Lobatto-Legendre quadrature points 
 
ModuleFactory & GetModuleFactory()
 
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.