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. More...
 
- Public Member Functions inherited from Nektar::Utilities::OutputModule
 OutputModule (FieldSharedPtr p_f)
 
void OpenStream ()
 Open a file for output. More...
 
 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. More...
 
void PrintConfig ()
 Print out all configuration options for a module. More...
 
void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
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 (std::string key, std::string value)
 
void PrintConfig ()
 
void SetDefaults ()
 
MeshSharedPtr GetMesh ()
 
virtual void ProcessVertices ()
 Extract element vertices. More...
 
virtual void ProcessEdges (bool ReprocessEdges=true)
 Extract element edges. More...
 
virtual void ProcessFaces (bool ReprocessFaces=true)
 Extract element faces. More...
 
virtual void ProcessElements ()
 Generate element IDs. More...
 
virtual void ProcessComposites ()
 Generate composites. More...
 
virtual void ClearElementLinks ()
 

Static Public Member Functions

static boost::shared_ptr< Modulecreate (FieldSharedPtr f)
 Creates an instance of this class. More...
 

Static Public Attributes

static ModuleKey m_className
 

Additional Inherited Members

- Protected Member Functions inherited from Nektar::Utilities::Module
 Module ()
 
void ReorderPrisms (PerMap &perFaces)
 Reorder node IDs so that prisms and tetrahedra are aligned correctly. More...
 
void PrismLines (int prism, PerMap &perFaces, std::set< int > &prismsDone, std::vector< ElementSharedPtr > &line)
 
- Protected Attributes inherited from Nektar::Utilities::OutputModule
ofstream m_fldFile
 Output stream. More...
 
std::ofstream m_mshFile
 Output stream. More...
 
- Protected Attributes inherited from Nektar::Utilities::Module
FieldSharedPtr m_f
 Field object. More...
 
map< string, ConfigOptionm_config
 List of configuration values. More...
 
bool m_requireEquiSpaced
 
MeshSharedPtr m_mesh
 Mesh object. More...
 
std::map< std::string,
ConfigOption
m_config
 List of configuration values. More...
 

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.

53  : OutputModule(f)
54 {
55 }
Nektar::Utilities::OutputInfo::~OutputInfo ( )
virtual

Definition at line 57 of file OutputInfo.cpp.

58 {
59 }

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.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

51  {
53  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
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.

62 {
63  // Extract the output filename and extension
64  string filename = m_config["outfile"].as<string>();
65  int i;
66 
67  if (m_f->m_verbose)
68  {
69  cout << "OutputInfo: Writing Info file..." << endl;
70  }
71 
72  // partition mesh
73  ASSERTL0(vm.count("nprocs") > 0,
74  "--nprocs nust be specified with info output");
75 
76  int nprocs = vm["nprocs"].as<int>();
77 
78  LibUtilities::CommSharedPtr vComm = boost::shared_ptr<FieldConvertComm>(
79  new FieldConvertComm(0, NULL, nprocs,0));
80  vComm->SplitComm(1,nprocs);
81 
82  // define new session with psuedo parallel communicator
83  string xml_ending = "xml";
84  string xml_gz_ending = "xml.gz";
85 
86  std::vector<std::string> files;
87  // load .xml ending
88  for (int i = 0; i < m_f->m_inputfiles[xml_ending].size(); ++i)
89  {
90  files.push_back(m_f->m_inputfiles[xml_ending][i]);
91  }
92 
93  // load any .xml.gz endings
94  for (int j =0; j < m_f->m_inputfiles[xml_gz_ending].size(); ++j)
95  {
96  files.push_back(m_f->m_inputfiles[xml_gz_ending][j]);
97  }
98 
100  boost::shared_ptr<LibUtilities::SessionReader>(
101  new LibUtilities::SessionReader(0,0,files,vComm));
102  vSession->SetUpXmlDoc();
103 
104  // Default partitioner to use is Metis. Use Scotch as default
105  // if it is installed. Override default with command-line flags
106  // if they are set.
107  string vPartitionerName = "Metis";
108  if (LibUtilities::GetMeshPartitionFactory().ModuleExists("Scotch"))
109  {
110  vPartitionerName = "Scotch";
111  }
112  if (vSession->DefinesCmdLineArgument("use-metis"))
113  {
114  vPartitionerName = "Metis";
115  }
116  if (vSession->DefinesCmdLineArgument("use-scotch"))
117  {
118  vPartitionerName = "Scotch";
119  }
120 
121  LibUtilities::MeshPartitionSharedPtr vMeshPartition =
123  vPartitionerName, vSession);
124 
125  vMeshPartition->PartitionMesh(nprocs, true);
126 
127  // get hold of local partition ids
128  std::vector<std::vector<unsigned int> > ElementIDs(nprocs);
129 
130  // Populate the list of element ID lists from all processes
131  for (i = 0; i < nprocs; ++i)
132  {
133  std::vector<unsigned int> tmp;
134  vMeshPartition->GetElementIDs(i,tmp);
135  ElementIDs[i] = tmp;
136  }
137 
138  // Set up output names
139  std::vector<std::string> filenames;
140  for(int i = 0; i < nprocs; ++i)
141  {
142  boost::format pad("P%1$07d.fld");
143  pad % i;
144  filenames.push_back(pad.str());
145  }
146 
147  // Write the output file
148  m_f->m_fld->WriteMultiFldFileIDs(filename,filenames, ElementIDs);
149 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:162
boost::shared_ptr< MeshPartition > MeshPartitionSharedPtr
map< string, ConfigOption > m_config
List of configuration values.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
FieldSharedPtr m_f
Field object.
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:53
MeshPartitionFactory & GetMeshPartitionFactory()

Member Data Documentation

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

Definition at line 54 of file OutputInfo.h.