Hide menu
Loading...
Searching...
No Matches
cadex::Mesh_NetgenOpenFOAMBCProvider Class Referenceabstract

Provides an interface to work with OpenFOAM custom boundary conditions descriptions. More...

#include <cadex/Mesh_NetgenOpenFOAMBCProvider.hxx>

Public Types

typedef std::pair< std::string, std::string > LineType
 A two-field line used in boundary conditions description (e.g. "type patch").
 
typedef std::list< LineTypeDescriptionListType
 A list of lines representing a boundary condition description.
 

Public Member Functions

virtual ~Mesh_NetgenOpenFOAMBCProvider ()
 Destructor.
 
virtual bool BCDescription (int theBCIndex, DescriptionListType &theDescriptionList)=0
 Provides a description for a boundary condition.
 

Detailed Description

Provides an interface to work with OpenFOAM custom boundary conditions descriptions.

Warning
This class is a part of Advanced Meshers add-on, which is licensed separately from the base CAD Exchanger SDK.

Subclasses must redefine the virtual BCDescription() method to return a string list representing a boundary condition. Below is an example of using a custom subclass storing list in an unordered_map:

class OpenFOAMTestBCProvider : public Mesh_NetgenOpenFOAMBCProvider
{
public:
bool SetBCDescription (int theBCIndex, const DescriptionListType& theLinesList)
{
return (myDescriptionsMap.emplace (theBCIndex, theLinesList)).second;
}
bool BCDescription (int theBCIndex, DescriptionListType& theLinesList) override
{
DescriptionsMapType::const_iterator anIter = myDescriptionsMap.find (theBCIndex);
if (anIter == myDescriptionsMap.end()) return false;
theLinesList = anIter->second;
return true;
}
private:
typedef std::unordered_map<int, DescriptionListType> DescriptionsMapType;
DescriptionsMapType myDescriptionsMap;
};
std::shared_ptr<OpenFOAMTestBCProvider> aDescriber (new OpenFOAMTestBCProvider);
OpenFOAMTestBCProvider::DescriptionListType aLinesList;
aLinesList.push_back (OpenFOAMTestBCProvider::LineType ("type", "patch"));
aLinesList.push_back (OpenFOAMTestBCProvider::LineType ("bcIndex", "first"));
aLinesList.push_back (OpenFOAMTestBCProvider::LineType ("customString", "lorem"));
aDescriber->SetBCDescription (1, aLinesList);
aLinesList.clear();
aLinesList.push_back (OpenFOAMTestBCProvider::LineType ("type", "wedge" ));
aLinesList.push_back (OpenFOAMTestBCProvider::LineType ("bcIndex", "second"));
aLinesList.push_back (OpenFOAMTestBCProvider::LineType ("customString", "ipsum" ));
aDescriber->SetBCDescription (2, aLinesList);
Mesh_NetgenOpenFOAMWriter aWriter = ...;
aWriter.SetBCProvider (aDescriber);
Provides an interface to work with OpenFOAM custom boundary conditions descriptions.
Definition: Mesh_NetgenOpenFOAMBCProvider.hxx:33
std::list< LineType > DescriptionListType
A list of lines representing a boundary condition description.
Definition: Mesh_NetgenOpenFOAMBCProvider.hxx:42

Member Function Documentation

◆ BCDescription()

virtual bool cadex::Mesh_NetgenOpenFOAMBCProvider::BCDescription ( int  theBCIndex,
DescriptionListType theDescriptionList 
)
pure virtual

Provides a description for a boundary condition.

Returns true if there is a description for a given BC index or false otherwise.