Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Nektar::Utilities::InputPts Class Reference

#include <InputPts.h>

Inheritance diagram for Nektar::Utilities::InputPts:
Inheritance graph
[legend]
Collaboration diagram for Nektar::Utilities::InputPts:
Collaboration graph
[legend]

Public Member Functions

 InputPts (FieldSharedPtr f)
 Set up InputPts object.
virtual ~InputPts ()
virtual void Process (po::variables_map &vm)
- Public Member Functions inherited from Nektar::Utilities::InputModule
 InputModule (FieldSharedPtr p_m)
void AddFile (string fileType, string fileName)
 InputModule (MeshSharedPtr p_m)
void OpenStream ()
 Open a file for input.
- Public Member Functions inherited from Nektar::Utilities::Module
 Module (FieldSharedPtr p_f)
void RegisterConfig (string key, string value)
 Register a configuration option with a module.
void PrintConfig ()
 Print out all configuration options for a module.
void SetDefaults ()
 Sets default configuration options for those which have not been set.
bool GetRequireEquiSpaced (void)
void SetRequireEquiSpaced (bool pVal)
void EvaluateTriFieldAtEquiSpacedPts (LocalRegions::ExpansionSharedPtr &exp, const Array< OneD, const NekDouble > &infield, Array< OneD, NekDouble > &outfield)
 Module (MeshSharedPtr p_m)
virtual void Process ()=0
void RegisterConfig (string key, string value)
void PrintConfig ()
void SetDefaults ()
MeshSharedPtr GetMesh ()
virtual void ProcessVertices ()
 Extract element vertices.

Static Public Member Functions

static ModuleSharedPtr create (FieldSharedPtr f)
 Creates an instance of this class.

Static Public Attributes

static ModuleKey m_className []
 ModuleKey for class.

Additional Inherited Members

- Protected Member Functions inherited from Nektar::Utilities::InputModule
void PrintSummary ()
 Print summary of elements.
void PrintSummary ()
 Print summary of elements.
- Protected Attributes inherited from Nektar::Utilities::InputModule
set< string > m_allowedFiles
std::ifstream m_mshFile
 Input stream.

Detailed Description

Input module for Xml files.

Definition at line 49 of file InputPts.h.

Constructor & Destructor Documentation

Nektar::Utilities::InputPts::InputPts ( FieldSharedPtr  f)

Set up InputPts object.

Definition at line 60 of file InputPts.cpp.

References Nektar::Utilities::InputModule::m_allowedFiles.

{
m_allowedFiles.insert("pts");
}
Nektar::Utilities::InputPts::~InputPts ( )
virtual

Definition at line 66 of file InputPts.cpp.

{
}

Member Function Documentation

static ModuleSharedPtr Nektar::Utilities::InputPts::create ( FieldSharedPtr  f)
inlinestatic

Creates an instance of this class.

Definition at line 57 of file InputPts.h.

void Nektar::Utilities::InputPts::Process ( po::variables_map &  vm)
virtual

Implements Nektar::Utilities::Module.

Definition at line 73 of file InputPts.cpp.

References ASSERTL0, Nektar::ParseUtils::GenerateOrderedStringVector(), Nektar::Utilities::Module::m_f, and npts.

{
if(m_f->m_verbose)
{
cout << "Processing input pts file" << endl;
}
string pts_ending = "pts";
TiXmlDocument docInput;
ASSERTL0(docInput.LoadFile((m_f->m_inputfiles["pts"][0]).c_str()),
"Unable to open file '" + m_f->m_inputfiles["pts"][0] + "'.");
TiXmlElement *nektar = docInput.FirstChildElement("NEKTAR");
TiXmlElement *points = nektar->FirstChildElement("POINTS");
int dim;
int err = points->QueryIntAttribute("DIM", &dim);
ASSERTL0(err == TIXML_SUCCESS, "Unable to read attribute DIM.");
int nfields;
std::string fields = points->Attribute("FIELDS");
if(!fields.empty())
{
fields.c_str(),m_f->m_fieldPts->m_fields);
ASSERTL0(valid,"Unable to process list of field variable in "
" FIELDS attribute: "+ fields);
}
nfields = m_f->m_fieldPts->m_nFields = m_f->m_fieldPts->m_fields.size();
int totvars = dim + nfields;
m_f->m_fieldPts->m_ptsDim = dim;
m_f->m_fieldPts->m_nFields = nfields;
m_f->m_fieldPts->m_pts = Array<OneD, Array<OneD, NekDouble> >(totvars);
TiXmlNode *pointsBody = points->FirstChild();
std::istringstream pointsDataStrm(pointsBody->ToText()->Value());
vector<NekDouble> pts;
NekDouble in_pts;
try
{
while(!pointsDataStrm.fail())
{
pointsDataStrm >> in_pts;
pts.push_back(in_pts);
}
}
catch(...)
{
ASSERTL0(false, "Unable to read Points data.");
}
int npts = pts.size()/totvars;
if(m_f->m_verbose)
{
cout << " Read " << npts << " points of dimension " << dim << " and "
<< nfields << " field variables" << endl;
}
for(int i = 0; i < totvars; ++i)
{
m_f->m_fieldPts->m_pts[i] = Array<OneD, NekDouble>(npts);
}
for(int i = 0; i < npts; ++i)
{
for(int j = 0; j < totvars; ++j)
{
m_f->m_fieldPts->m_pts[j][i] = pts[i*totvars +j];
}
}
}

Member Data Documentation

ModuleKey Nektar::Utilities::InputPts::m_className
static
Initial value:

ModuleKey for class.

Definition at line 62 of file InputPts.h.