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

Converter from fld to pts. More...

#include <OutputPts.h>

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

Public Member Functions

 OutputPts (FieldSharedPtr f)
 
virtual ~OutputPts ()
 
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

Converter from fld to pts.

Definition at line 48 of file OutputPts.h.

Constructor & Destructor Documentation

Nektar::Utilities::OutputPts::OutputPts ( FieldSharedPtr  f)

Definition at line 52 of file OutputPts.cpp.

52  : OutputModule(f)
53 {
54 }
Nektar::Utilities::OutputPts::~OutputPts ( )
virtual

Definition at line 56 of file OutputPts.cpp.

57 {
58 }

Member Function Documentation

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

Creates an instance of this class.

Definition at line 52 of file OutputPts.h.

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

53  {
55  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Nektar::Utilities::OutputPts::Process ( po::variables_map &  vm)
virtual

Write fld to output file.

Implements Nektar::Utilities::Module.

Definition at line 60 of file OutputPts.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::Utilities::Module::m_config, Nektar::Utilities::Module::m_f, and Nektar::LibUtilities::ReduceSum.

61 {
62  // Extract the output filename and extension
63  string filename = m_config["outfile"].as<string>();
64 
65  if (m_f->m_verbose)
66  {
67  cout << "OutputPts: Writing file..." << endl;
68  }
69 
70  fs::path writefile(filename);
71  int writepts = 1;
72  if (fs::exists(writefile) && (vm.count("forceoutput") == 0))
73  {
74  LibUtilities::CommSharedPtr comm = m_f->m_session->GetComm();
75  int rank = comm->GetRank();
76  writepts = 0; // set to zero for reduce all to be correct.
77 
78  if (rank == 0)
79  {
80  string answer;
81  cout << "Did you wish to overwrite " << filename << " (y/n)? ";
82  getline(cin, answer);
83  if (answer.compare("y") == 0)
84  {
85  writepts = 1;
86  }
87  else
88  {
89  cout << "Not writing file " << filename
90  << " because it already exists" << endl;
91  }
92  }
93 
94  comm->AllReduce(writepts, LibUtilities::ReduceSum);
95  }
96 
97  if (writepts)
98  {
99  LibUtilities::PtsIO ptsIO(m_f->m_session->GetComm());
100  Array<OneD, Array<OneD, NekDouble> > tmp(
101  m_f->m_graph->GetMeshDimension() +
102  m_f->m_fielddef[0]->m_fields.size());
103 
104  switch (m_f->m_graph->GetMeshDimension())
105  {
106  case 1:
107  tmp[0] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
108  m_f->m_exp[0]->GetCoords(tmp[0]);
109  break;
110 
111  case 2:
112  tmp[1] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
113  tmp[0] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
114  m_f->m_exp[0]->GetCoords(tmp[0], tmp[1]);
115  break;
116 
117  case 3:
118  tmp[2] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
119  tmp[1] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
120  tmp[0] = Array<OneD, NekDouble>(m_f->m_exp[0]->GetTotPoints());
121  m_f->m_exp[0]->GetCoords(tmp[0], tmp[1], tmp[2]);
122  break;
123  }
124 
125  for (int i = 0; i < m_f->m_fielddef[0]->m_fields.size(); ++i)
126  {
127  tmp[i + m_f->m_graph->GetMeshDimension()] =
128  m_f->m_exp[i]->GetPhys();
129  }
132  m_f->m_graph->GetMeshDimension(),
133  m_f->m_fielddef[0]->m_fields,
134  tmp);
135  ptsIO.Write(filename, tmpPts);
136  }
137 }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
map< string, ConfigOption > m_config
List of configuration values.
FieldSharedPtr m_f
Field object.
boost::shared_ptr< PtsField > PtsFieldSharedPtr
Definition: PtsField.h:262
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:53

Member Data Documentation

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

Definition at line 56 of file OutputPts.h.