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

This processing module sets up for the boundary field to be extracted. More...

#include <ProcessBoundaryExtract.h>

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

Public Member Functions

 ProcessBoundaryExtract (FieldSharedPtr f)
 
virtual ~ProcessBoundaryExtract ()
 
virtual void Process (po::variables_map &vm)
 
- 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)
 
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 (string key, 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 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, set< int > &prismsDone, vector< ElementSharedPtr > &line)
 
- 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...
 

Detailed Description

This processing module sets up for the boundary field to be extracted.

Definition at line 49 of file ProcessBoundaryExtract.h.

Constructor & Destructor Documentation

Nektar::Utilities::ProcessBoundaryExtract::ProcessBoundaryExtract ( FieldSharedPtr  f)

Definition at line 55 of file ProcessBoundaryExtract.cpp.

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

55  : ProcessModule(f)
56 {
57  // set up dafault values.
58  m_config["bnd"] = ConfigOption(false,"All","Boundary to be extracted");
59  m_config["fldtoboundary"] = ConfigOption(true,"NotSet","Extract fld values to boundary");
60  m_config["addnormals"] = ConfigOption(true,"NotSet","Add normals to output");
61 
62 
63  f->m_writeBndFld = true;
64  f->m_declareExpansionAsContField = true;
65  f->m_declareAsNewField = true;
66 
67 }
map< string, ConfigOption > m_config
List of configuration values.
Nektar::Utilities::ProcessBoundaryExtract::~ProcessBoundaryExtract ( )
virtual

Definition at line 69 of file ProcessBoundaryExtract.cpp.

70 {
71 }

Member Function Documentation

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

Creates an instance of this class.

Definition at line 53 of file ProcessBoundaryExtract.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::ProcessBoundaryExtract::Process ( po::variables_map &  vm)
virtual

Implements Nektar::Utilities::Module.

Definition at line 73 of file ProcessBoundaryExtract.cpp.

References ASSERTL0, Nektar::ParseUtils::GenerateOrderedVector(), Nektar::SpatialDomains::BoundaryConditions::GetBoundaryRegions(), Nektar::Utilities::Module::m_config, Nektar::Utilities::Module::m_f, Nektar::LibUtilities::ReduceMax, Nektar::Timer::Start(), Nektar::Timer::Stop(), and Nektar::Timer::TimePerTest().

74 {
75  Timer timer;
76 
77  if (m_f->m_verbose)
78  {
79  if(m_f->m_comm->GetRank() == 0)
80  {
81  cout << "Process Boundary Extract: Setting up boundary extraction..." << endl;
82  timer.Start();
83  }
84  }
85 
86 
87  // check for correct input files
88  if((m_f->m_inputfiles.count("xml") == 0)&&(m_f->m_inputfiles.count("xml.gz") == 0))
89  {
90  cout << "An xml or xml.gz input file must be specified for the boundary extraction module" << endl;
91  exit(3);
92  }
93 
94  if((m_f->m_inputfiles.count("fld") == 0)&&(m_f->m_inputfiles.count("chk") == 0)&&(m_f->m_inputfiles.count("rst") == 0))
95  {
96  cout << "A fld or chk or rst input file must be specified for the boundary extraction module" << endl;
97 
98  exit(3);
99  }
100 
101  // Set up Field options to output boundary fld
102  string bvalues = m_config["bnd"].as<string>();
103 
104  if(boost::iequals(bvalues,"All"))
105  {
106  int numBndExp = 0;
107 
109  m_f->m_exp[0]->GetGraph());
111  bcs.GetBoundaryRegions();
112 
113  SpatialDomains::BoundaryRegionCollection::const_iterator breg_it;
114  for(breg_it = bregions.begin(); breg_it != bregions.end();
115  ++breg_it)
116  {
117  numBndExp = max(numBndExp,breg_it->first);
118  }
119  // assuming all boundary regions are consecutive number if
120  // regions is one more tham maximum id
121  numBndExp++;
122 
123  // not all partitions in parallel touch all boundaries so
124  // find maximum number of boundaries
125  m_f->m_session->GetComm()->AllReduce(numBndExp,LibUtilities::ReduceMax);
126 
127  // THis presumes boundary regions are numbered consecutively
128  for(int i = 0; i < numBndExp; ++i)
129  {
130  m_f->m_bndRegionsToWrite.push_back(i);
131  }
132  }
133  else
134  {
136  m_f->m_bndRegionsToWrite),
137  "Failed to interpret bnd values string");
138  }
139 
140  m_f->m_fldToBnd = m_config["fldtoboundary"].m_beenSet;
141  m_f->m_addNormals = m_config["addnormals"].m_beenSet;
142 
143  if(m_f->m_verbose)
144  {
145  if(m_f->m_comm->GetRank() == 0)
146  {
147  timer.Stop();
148  NekDouble cpuTime = timer.TimePerTest(1);
149 
150  stringstream ss;
151  ss << cpuTime << "s";
152  cout << "Process Boundary Extract CPU Time: " << setw(8) << left
153  << ss.str() << endl;
154  cpuTime = 0.0;
155  }
156  }
157 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
static bool GenerateOrderedVector(const char *const str, std::vector< unsigned int > &vec)
Definition: ParseUtils.hpp:97
map< string, ConfigOption > m_config
List of configuration values.
FieldSharedPtr m_f
Field object.
void Stop()
Definition: Timer.cpp:62
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
Definition: Conditions.h:206
double NekDouble
const BoundaryRegionCollection & GetBoundaryRegions(void) const
Definition: Conditions.h:227
void Start()
Definition: Timer.cpp:51
NekDouble TimePerTest(unsigned int n)
Returns amount of seconds per iteration in a test with n iterations.
Definition: Timer.cpp:108

Member Data Documentation

ModuleKey Nektar::Utilities::ProcessBoundaryExtract::className
static
Initial value:

Definition at line 56 of file ProcessBoundaryExtract.h.