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

#include <OutputInfo.h>

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

Public Member Functions

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

Static Public Attributes

static ModuleKey m_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::OutputModule
ofstream m_fldFile
 Output stream.
std::ofstream m_mshFile
 Output stream.

Detailed Description

Definition at line 47 of file OutputInfo.h.

Constructor & Destructor Documentation

Nektar::Utilities::OutputInfo::OutputInfo ( FieldSharedPtr  f)

Definition at line 53 of file OutputInfo.cpp.

{
}
Nektar::Utilities::OutputInfo::~OutputInfo ( )
virtual

Definition at line 57 of file OutputInfo.cpp.

{
}

Member Function Documentation

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

Creates an instance of this class.

Definition at line 51 of file OutputInfo.h.

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

Write fld to output file.

Implements Nektar::Utilities::Module.

Definition at line 61 of file OutputInfo.cpp.

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

{
// Extract the output filename and extension
string filename = m_config["outfile"].as<string>();
int i;
if (m_f->m_verbose)
{
cout << "OutputInfo: Writing Info file..." << endl;
}
// partition mesh
ASSERTL0(vm.count("nprocs") > 0,
"--nprocs nust be specified with info output");
int nprocs = vm["nprocs"].as<int>();
LibUtilities::CommSharedPtr vComm = boost::shared_ptr<FieldConvertComm>(
new FieldConvertComm(0, NULL, nprocs,0));
vComm->SplitComm(1,nprocs);
// define new session with psuedo parallel communicator
string xml_ending = "xml";
string xml_gz_ending = "xml.gz";
std::vector<std::string> files;
// load .xml ending
for (int i = 0; i < m_f->m_inputfiles[xml_ending].size(); ++i)
{
files.push_back(m_f->m_inputfiles[xml_ending][i]);
}
// load any .xml.gz endings
for (int j =0; j < m_f->m_inputfiles[xml_gz_ending].size(); ++j)
{
files.push_back(m_f->m_inputfiles[xml_gz_ending][j]);
}
boost::shared_ptr<LibUtilities::SessionReader>(
new LibUtilities::SessionReader(0,0,files,vComm));
vSession->SetUpXmlDoc();
// Default partitioner to use is Metis. Use Scotch as default
// if it is installed. Override default with command-line flags
// if they are set.
string vPartitionerName = "Metis";
if (LibUtilities::GetMeshPartitionFactory().ModuleExists("Scotch"))
{
vPartitionerName = "Scotch";
}
if (vSession->DefinesCmdLineArgument("use-metis"))
{
vPartitionerName = "Metis";
}
if (vSession->DefinesCmdLineArgument("use-scotch"))
{
vPartitionerName = "Scotch";
}
vPartitionerName, vSession);
vMeshPartition->PartitionMesh(false);
// get hold of local partition ids
std::vector<std::vector<unsigned int> > ElementIDs(nprocs);
// Populate the list of element ID lists from all processes
for (i = 0; i < nprocs; ++i)
{
std::vector<unsigned int> tmp;
vMeshPartition->GetElementIDs(i,tmp);
ElementIDs[i] = tmp;
}
// Set up output names
std::vector<std::string> filenames;
for(int i = 0; i < nprocs; ++i)
{
boost::format pad("P%1$07d.fld");
pad % i;
filenames.push_back(pad.str());
}
// Write the output file
m_f->m_fld->WriteMultiFldFileIDs(filename,filenames, ElementIDs);
}

Member Data Documentation

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

Definition at line 54 of file OutputInfo.h.