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

This processing module calculates the Jacobian of elements using SpatialDomains::GeomFactors and the Element::GetGeom method. For now it simply prints a list of elements which have negative Jacobian. More...

#include <ProcessScalar.h>

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

Public Member Functions

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

Static Public Attributes

static ModuleKey className

Additional Inherited Members

- Protected Member Functions inherited from Nektar::Utilities::Module
 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 calculates the Jacobian of elements using SpatialDomains::GeomFactors and the Element::GetGeom method. For now it simply prints a list of elements which have negative Jacobian.

Definition at line 51 of file ProcessScalar.h.

Constructor & Destructor Documentation

Nektar::Utilities::ProcessScalar::ProcessScalar ( MeshSharedPtr  m)

Definition at line 56 of file ProcessScalar.cpp.

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

{
m_config["surf"] = ConfigOption(false, "-1",
"Tag identifying surface/composite to process.");
m_config["nq"] = ConfigOption(false, "-1",
"Number of quadrature points to generate.");
m_config["scalar"] = ConfigOption(false, "",
"Expression to evaluate.");
}
Nektar::Utilities::ProcessScalar::~ProcessScalar ( )
virtual

Definition at line 66 of file ProcessScalar.cpp.

{
}

Member Function Documentation

static boost::shared_ptr<Module> Nektar::Utilities::ProcessScalar::create ( MeshSharedPtr  m)
inlinestatic

Creates an instance of this class.

Definition at line 55 of file ProcessScalar.h.

{
return MemoryManager<ProcessScalar>::AllocateSharedPtr(m);
}
void Nektar::Utilities::ProcessScalar::Process ( )
virtual

Write mesh to output file.

Implements Nektar::Utilities::Module.

Definition at line 70 of file ProcessScalar.cpp.

References Nektar::LibUtilities::AnalyticExpressionEvaluator::DefineFunction(), Nektar::ParseUtils::GenerateSeqVector(), Nektar::Utilities::Module::m_config, Nektar::Utilities::Module::m_mesh, Nektar::Utilities::Node::m_x, Nektar::Utilities::Node::m_y, and Nektar::Utilities::Node::m_z.

{
int i, j, k;
string surf = m_config["surf"].as<string>();
// Obtain vector of surface IDs from string.
vector<unsigned int> surfs;
ParseUtils::GenerateSeqVector(surf.c_str(), surfs);
sort(surfs.begin(), surfs.end());
// If we're running in verbose mode print out a list of surfaces.
if (m_mesh->m_verbose)
{
cout << "ProcessScalar: extracting surface"
<< (surfs.size() > 1 ? "s" : "") << " " << surf << endl;
}
const int nq = m_config["nq"].as<int>();
string expr = m_config["scalar"].as<string>();
LibUtilities::AnalyticExpressionEvaluator rEval;
int rExprId = rEval.DefineFunction("x y z", expr);
// Make a copy of all existing elements of one dimension lower.
vector<ElementSharedPtr> el = m_mesh->m_element[m_mesh->m_expDim-1];
// Iterate over list of surface elements.
for (i = 0; i < el.size(); ++i)
{
// Work out whether this lies on our surface of interest.
vector<int> inter, tags = el[i]->GetTagList();
sort(tags.begin(), tags.end());
set_intersection(surfs.begin(), surfs.end(),
tags .begin(), tags .end(),
back_inserter(inter));
// It doesn't continue to next element.
if (inter.size() != 1)
{
continue;
}
// Grab face link.
FaceSharedPtr f = el[i]->GetFaceLink();
// Update vertices
for (j = 0; j < 4; ++j)
{
NodeSharedPtr n = f->m_vertexList[j];
n->m_z = rEval.Evaluate(rExprId, n->m_x, n->m_y, 0.0, 0.0);
if (n->m_z < 1e-32)
{
n->m_z = 0;
}
}
// Put curvature into edges
for (j = 0; j < f->m_edgeList.size(); ++j)
{
NodeSharedPtr n1 = f->m_edgeList[j]->m_n1;
NodeSharedPtr n2 = f->m_edgeList[j]->m_n2;
Node disp = *n2-*n1;
f->m_edgeList[j]->m_edgeNodes.clear();
for (k = 1; k < nq-1; ++k)
{
Node n = *n1 + disp * k / (nq-1.0);
n.m_z = rEval.Evaluate(rExprId, n.m_x, n.m_y, 0.0, 0.0);
if (n.m_z < 1e-32)
{
n.m_z = 0;
}
f->m_edgeList[j]->m_edgeNodes.push_back(
NodeSharedPtr(new Node(n)));
}
}
}
}

Member Data Documentation

ModuleKey Nektar::Utilities::ProcessScalar::className
static
Initial value:
"Impose a scalar function z=f(x,y) on a surface.")

Definition at line 58 of file ProcessScalar.h.