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

This processing module interpolates one field to another. More...

#include <ProcessInterpPointDataToFld.h>

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

Public Member Functions

 ProcessInterpPointDataToFld (FieldSharedPtr f)
virtual ~ProcessInterpPointDataToFld ()
virtual void Process (po::variables_map &vm)
 Write mesh to output file.
- Public Member Functions inherited from Nektar::Utilities::ProcessModule
 ProcessModule (FieldSharedPtr p_f)
 ProcessModule (MeshSharedPtr p_m)
- 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)
 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 boost::shared_ptr< Modulecreate (FieldSharedPtr f)
 Creates an instance of this class.

Static Public Attributes

static ModuleKey className

Additional Inherited Members

- Protected Member Functions inherited from Nektar::Utilities::Module
virtual void ProcessEdges (bool ReprocessEdges=true)
 Extract element edges.
virtual void ProcessFaces (bool ReprocessFaces=true)
 Extract element faces.
virtual void ProcessElements ()
 Generate element IDs.
virtual void ProcessComposites ()
 Generate composites.
void ReorderPrisms (PerMap &perFaces)
 Reorder node IDs so that prisms and tetrahedra are aligned correctly.
void PrismLines (int prism, PerMap &perFaces, set< int > &prismsDone, vector< ElementSharedPtr > &line)
- Protected Attributes inherited from Nektar::Utilities::Module
FieldSharedPtr m_f
 Field object.
map< string, ConfigOptionm_config
 List of configuration values.
bool m_requireEquiSpaced
MeshSharedPtr m_mesh
 Mesh object.

Detailed Description

This processing module interpolates one field to another.

Definition at line 49 of file ProcessInterpPointDataToFld.h.

Constructor & Destructor Documentation

Nektar::Utilities::ProcessInterpPointDataToFld::ProcessInterpPointDataToFld ( FieldSharedPtr  f)

Definition at line 58 of file ProcessInterpPointDataToFld.cpp.

References Nektar::Utilities::Module::m_config.

{
m_config["interpcoord"] = ConfigOption(false, "0",
"coordinate id ot use for interpolation");
}
Nektar::Utilities::ProcessInterpPointDataToFld::~ProcessInterpPointDataToFld ( )
virtual

Definition at line 67 of file ProcessInterpPointDataToFld.cpp.

{
}

Member Function Documentation

static boost::shared_ptr<Module> Nektar::Utilities::ProcessInterpPointDataToFld::create ( FieldSharedPtr  f)
inlinestatic

Creates an instance of this class.

Definition at line 53 of file ProcessInterpPointDataToFld.h.

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

Write mesh to output file.

Implements Nektar::Utilities::Module.

Definition at line 71 of file ProcessInterpPointDataToFld.cpp.

References ASSERTL0, Nektar::Utilities::Module::m_config, Nektar::Utilities::Module::m_f, and Nektar::Utilities::NullFieldPts.

{
int i,j;
if(m_f->m_verbose)
{
cout << "Processing point data interpolation (linear)" << endl;
}
// Check for command line point specification if no .pts file specified
ASSERTL0(m_f->m_fieldPts != NullFieldPts,
"No input points found");
ASSERTL0(m_f->m_fieldPts->m_nFields > 0,
"No field values provided in input");
// assume one field is already defined from input file.
m_f->m_exp.resize(m_f->m_fieldPts->m_nFields+1);
for(i = 1; i < m_f->m_fieldPts->m_nFields; ++i)
{
m_f->m_exp[i] = m_f->AppendExpList(0);
}
if(m_f->m_session->GetComm()->GetRank() == 0)
{
cout << "Interpolating [" << flush;
}
int totpoints = m_f->m_exp[0]->GetTotPoints();
Array<OneD,NekDouble> coords[3];
coords[0] = Array<OneD,NekDouble>(totpoints);
coords[1] = Array<OneD,NekDouble>(totpoints);
coords[2] = Array<OneD,NekDouble>(totpoints);
m_f->m_exp[0]->GetCoords(coords[0],coords[1],coords[2]);
int coord_id = m_config["interpcoord"].as<int>();
// interpolate points and transform
Array<OneD, NekDouble> intfields(m_f->m_fieldPts->m_nFields);
for(i = 0; i < totpoints; ++i)
{
m_f->m_fieldPts->Interp1DPts(coords[coord_id][i],intfields);
for(j = 0; j < m_f->m_fieldPts->m_nFields; ++j)
{
m_f->m_exp[j]->SetPhys(i,intfields[j]);
}
}
if(m_f->m_session->GetComm()->GetRank() == 0)
{
cout << "]" << endl;
}
// forward transform fields
for(i = 0; i < m_f->m_fieldPts->m_nFields; ++i)
{
m_f->m_exp[i]->FwdTrans_IterPerExp(m_f->m_exp[i]->GetPhys(),
m_f->m_exp[i]->UpdateCoeffs());
}
// set up output fld file.
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
= m_f->m_exp[0]->GetFieldDefinitions();
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
for (j = 0; j < m_f->m_fieldPts->m_nFields; ++j)
{
for (i = 0; i < FieldDef.size(); ++i)
{
FieldDef[i]->m_fields.push_back(m_f->m_fieldPts->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::ProcessInterpPointDataToFld::className
static
Initial value:
ModuleKey(eProcessModule, "interppointdatatofld"),
"Interpolates given discrete data using a finite differece "
"approximation to a fld file given a xml file")

Definition at line 56 of file ProcessInterpPointDataToFld.h.