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::InputFld Class Reference

#include <InputFld.h>

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

Public Member Functions

 InputFld (FieldSharedPtr f)
 Set up InputFld object.
virtual ~InputFld ()
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

Converter for Fld files.

Definition at line 48 of file InputFld.h.

Constructor & Destructor Documentation

Nektar::Utilities::InputFld::InputFld ( FieldSharedPtr  f)

Set up InputFld object.

Definition at line 66 of file InputFld.cpp.

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

{
m_allowedFiles.insert("fld");
m_allowedFiles.insert("chk");
m_allowedFiles.insert("rst");
}
Nektar::Utilities::InputFld::~InputFld ( )
virtual

Definition at line 73 of file InputFld.cpp.

{
}

Member Function Documentation

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

Creates an instance of this class.

Definition at line 56 of file InputFld.h.

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

Implements Nektar::Utilities::Module.

Definition at line 80 of file InputFld.cpp.

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, >::CreateInstance(), Nektar::LibUtilities::GetCommFactory(), Nektar::Utilities::Module::m_f, and Nektar::LibUtilities::NullFieldMetaDataMap.

{
if(m_f->m_verbose)
{
cout << "Processing input fld file" << endl;
}
int i,j;
string fldending;
//Determine appropriate field input
if(m_f->m_inputfiles.count("fld") != 0)
{
fldending = "fld";
}
else if(m_f->m_inputfiles.count("chk") != 0)
{
fldending = "chk";
}
else if (m_f->m_inputfiles.count("rst") != 0)
{
fldending = "rst";
}
else
{
ASSERTL0(false,"no input file found");
}
if(!m_f->m_fld)
{
if(m_f->m_session)
{
::AllocateSharedPtr(m_f->m_session->GetComm());
}
else // serial communicator
{
}
}
if(m_f->m_graph) // all for restricted expansion defintion when loading field
{
// currently load all field (possibly could read data from expansion list
// but it is re-arranged in expansion)
const SpatialDomains::ExpansionMap &expansions = m_f->m_graph->GetExpansions();
// if Range has been speficied it is possible to have a
// partition which is empty so ccheck this and return if
// no elements present.
if(!expansions.size())
{
return;
}
m_f->m_exp.resize(1);
Array<OneD,int> ElementGIDs(expansions.size());
SpatialDomains::ExpansionMap::const_iterator expIt;
i = 0;
for (expIt = expansions.begin(); expIt != expansions.end(); ++expIt)
{
ElementGIDs[i++] = expIt->second->m_geomShPtr->GetGlobalID();
}
m_f->m_fielddef.clear();
m_f->m_data.clear();
m_f->m_fld->Import(m_f->m_inputfiles[fldending][0],
m_f->m_fielddef,
m_f->m_data,
ElementGIDs);
}
else // load all data.
{
m_f->m_fld->Import(m_f->m_inputfiles[fldending][0],
m_f->m_fielddef,
m_f->m_data);
}
// if m_exp defined presume we want to load all field into expansions
if(m_f->m_exp.size())
{
int nfields;
if(vm.count("useSessionVariables"))
{
nfields = m_f->m_session->GetVariables().size();
}
else
{
nfields = m_f->m_fielddef[0]->m_fields.size();
}
m_f->m_exp.resize(nfields);
vector<string> vars = m_f->m_session->GetVariables();
// declare other fields;
for (i = 1; i < nfields; ++i)
{
if(i < vars.size())
{
m_f->m_exp[i] = m_f->AppendExpList(m_f->m_fielddef[0]->m_numHomogeneousDir,
vars[i]);
}
else
{
if(vars.size())
{
m_f->m_exp[i] = m_f->AppendExpList(m_f->m_fielddef[0]->m_numHomogeneousDir,vars[0]);
}
else
{
m_f->m_exp[i] = m_f->AppendExpList(m_f->m_fielddef[0]->m_numHomogeneousDir);
}
}
}
for (j = 0; j < nfields; ++j)
{
for (i = 0; i < m_f->m_data.size(); ++i)
{
m_f->m_exp[j]->ExtractDataToCoeffs(m_f->m_fielddef[i],
m_f->m_data[i],
m_f->m_fielddef[i]->m_fields[j],
m_f->m_exp[j]->UpdateCoeffs());
}
m_f->m_exp[j]->BwdTrans(m_f->m_exp[j]->GetCoeffs(),
m_f->m_exp[j]->UpdatePhys());
}
// if range is defined reset up output field in case or
// reducing fld definition
if(vm.count("range"))
{
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
= m_f->m_exp[0]->GetFieldDefinitions();
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
for (j = 0; j < nfields; ++j)
{
for (i = 0; i < FieldDef.size(); ++i)
{
FieldDef[i]->m_fields.push_back(m_f->m_fielddef[0]->m_fields[j]);
m_f->m_exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
}
}
m_f->m_fielddef = FieldDef;
m_f->m_data = FieldData;
}
}
}

Member Data Documentation

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

ModuleKey for class.

Definition at line 61 of file InputFld.h.