Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Nektar::FieldUtils::ProcessBoundaryExtract Class Reference

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

#include <ProcessBoundaryExtract.h>

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

Public Member Functions

 ProcessBoundaryExtract (FieldSharedPtr f)
 
virtual ~ProcessBoundaryExtract ()
 
virtual void Process (po::variables_map &vm)
 
virtual std::string GetModuleName ()
 
- Public Member Functions inherited from Nektar::FieldUtils::ProcessModule
 ProcessModule ()
 
 ProcessModule (FieldSharedPtr p_f)
 
- Public Member Functions inherited from Nektar::FieldUtils::Module
FIELD_UTILS_EXPORT Module (FieldSharedPtr p_f)
 
FIELD_UTILS_EXPORT void RegisterConfig (string key, string value)
 Register a configuration option with a module. More...
 
FIELD_UTILS_EXPORT void PrintConfig ()
 Print out all configuration options for a module. More...
 
FIELD_UTILS_EXPORT void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
FIELD_UTILS_EXPORT bool GetRequireEquiSpaced (void)
 
FIELD_UTILS_EXPORT void SetRequireEquiSpaced (bool pVal)
 
FIELD_UTILS_EXPORT void EvaluateTriFieldAtEquiSpacedPts (LocalRegions::ExpansionSharedPtr &exp, const Array< OneD, const NekDouble > &infield, Array< OneD, NekDouble > &outfield)
 

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::FieldUtils::Module
 Module ()
 
- Protected Attributes inherited from Nektar::FieldUtils::Module
FieldSharedPtr m_f
 Field object. More...
 
map< string, ConfigOptionm_config
 List of configuration values. More...
 
bool m_requireEquiSpaced
 

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::FieldUtils::ProcessBoundaryExtract::ProcessBoundaryExtract ( FieldSharedPtr  f)

Definition at line 56 of file ProcessBoundaryExtract.cpp.

References Nektar::FieldUtils::Module::m_config.

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

Definition at line 71 of file ProcessBoundaryExtract.cpp.

72 {
73 }

Member Function Documentation

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

Creates an instance of this class.

Definition at line 53 of file ProcessBoundaryExtract.h.

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

54  {
56  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
virtual std::string Nektar::FieldUtils::ProcessBoundaryExtract::GetModuleName ( )
inlinevirtual

Implements Nektar::FieldUtils::Module.

Definition at line 64 of file ProcessBoundaryExtract.h.

65  {
66  return "ProcessBoundaryExtract";
67  }
void Nektar::FieldUtils::ProcessBoundaryExtract::Process ( po::variables_map &  vm)
virtual

Implements Nektar::FieldUtils::Module.

Definition at line 75 of file ProcessBoundaryExtract.cpp.

References ASSERTL0, Nektar::ParseUtils::GenerateOrderedVector(), Nektar::SpatialDomains::BoundaryConditions::GetBoundaryRegions(), Nektar::FieldUtils::Module::m_config, Nektar::FieldUtils::Module::m_f, and Nektar::LibUtilities::ReduceMax.

76 {
77  if (m_f->m_verbose)
78  {
79  if (m_f->m_comm->TreatAsRankZero())
80  {
81  cout << "ProcessBoundaryExtract: Setting up boundary extraction..."
82  << endl;
83  }
84  }
85 
86  m_f->m_fldToBnd = m_config["fldtoboundary"].m_beenSet;
87  m_f->m_addNormals = m_config["addnormals"].m_beenSet;
88 
89  // check for correct input files
90  if ((m_f->m_inputfiles.count("xml") == 0) &&
91  (m_f->m_inputfiles.count("xml.gz") == 0))
92  {
93  cout << "An xml or xml.gz input file must be specified for the "
94  "boundary extraction module"
95  << endl;
96  exit(3);
97  }
98 
99  if (m_f->m_fldToBnd)
100  {
101  if ((m_f->m_inputfiles.count("fld") == 0) &&
102  (m_f->m_inputfiles.count("chk") == 0) &&
103  (m_f->m_inputfiles.count("rst") == 0))
104  {
105  cout << "A fld or chk or rst input file must be specified for "
106  << "the boundary extraction module with fldtoboundary option."
107  << endl;
108 
109  exit(3);
110  }
111  }
112 
113  // Set up Field options to output boundary fld
114  string bvalues = m_config["bnd"].as<string>();
115 
116  if (boost::iequals(bvalues, "All"))
117  {
118  int numBndExp = 0;
119 
120  SpatialDomains::BoundaryConditions bcs(m_f->m_session,
121  m_f->m_exp[0]->GetGraph());
123  bcs.GetBoundaryRegions();
124 
125  SpatialDomains::BoundaryRegionCollection::const_iterator breg_it;
126  for (breg_it = bregions.begin(); breg_it != bregions.end(); ++breg_it)
127  {
128  numBndExp = max(numBndExp, breg_it->first);
129  }
130  // assuming all boundary regions are consecutive number if
131  // regions is one more tham maximum id
132  numBndExp++;
133 
134  // not all partitions in parallel touch all boundaries so
135  // find maximum number of boundaries
136  m_f->m_session->GetComm()->AllReduce(numBndExp,
138 
139  // THis presumes boundary regions are numbered consecutively
140  for (int i = 0; i < numBndExp; ++i)
141  {
142  m_f->m_bndRegionsToWrite.push_back(i);
143  }
144  }
145  else
146  {
148  m_f->m_bndRegionsToWrite),
149  "Failed to interpret bnd values string");
150  }
151 }
map< string, ConfigOption > m_config
List of configuration values.
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
static bool GenerateOrderedVector(const char *const str, std::vector< unsigned int > &vec)
Definition: ParseUtils.hpp:97
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
Definition: Conditions.h:217
FieldSharedPtr m_f
Field object.

Member Data Documentation

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

Definition at line 57 of file ProcessBoundaryExtract.h.