![]() |
GemaCoreLib
The GeMA Core library
|
A class used to represent a set of boundary conditions of the same type, tied to the same mesh. More...
#include <gmBoundaryCondition.h>
Public Member Functions | |
GmBoundaryCondition (QString id, QString description, QString type, GmMesh *mesh, BcType bcType) | |
Constructor. See parameter description on the GmBoundaryConditionBase constructor documentation. | |
virtual | ~GmBoundaryCondition () |
Destructor. | |
GmBoundaryConditionAccessor * | propertyAccessor (QString propertyId, Unit desiredUnit, const GmLogCategory &logger) const |
Returns an accessor for property values in the desired unit (can be a default unit for no unit conversion). More... | |
bool | hasTags () const |
Returns true if any of the B.c. properties has a tag. | |
bool | tagNeedsPerNodeEvaluation () const |
Returns true, for node BCs only, when the tag set includes properties with either ignoreDef or ignoreZero set AND the property accessor can be function based, meaning that the tag mask can be different for nodes in the same bcIndex. | |
quint64 | tagMask (int bcIndex, int listIndex) const |
Returns tha tag mask for the given index, oring together the tags for each property with a tag, respecting the ignore def and ignore zero settings for each tag (for NODE BCs only). | |
![]() | |
virtual | ~GmBoundaryConditionBase () |
Destructor. | |
QString | id () const |
Returns the boundary condition name. | |
QString | description () const |
Returns the boundary condition description. | |
QString | type () const |
Returns the boundary condition type, to be interpreted by a physics object. | |
GmMesh * | mesh () const |
Returns the mesh that this boundary conditions are tied to. | |
BcType | bcType () const |
Returns the type of bc, defining if the bc should be applied over nodes, edges or faces. | |
int | numValues () const |
Returns the number of boundary conditions (lines) stored in the object. | |
int | numProperties () const |
Returns the number of properties (columns) stored for each condition in the object. | |
QStringList | propertyIds () const |
Returns the ids of the properties stored in this object (no special order is enforced) | |
GmValueInfo * | propertyInfo (QString propertyId) const |
Returns metadata information about a property or NULL if the property doesn't exists. | |
bool | addProperty (GmValueInfo *info, GmSimulationData *data, const GmLogCategory &logger) |
Creates a new property for storing data associated with the metadata information received as a parameter in 'info'. More... | |
int | numNodes (int bcIndex) const |
Returns the number of nodes over which the referenced boundary condition is applied. Must be called only for objects with bcType() == GM_BC_NODE. The parameter bcIndex should be a value between 0 and numValues()-1;. More... | |
int | node (int bcIndex, int nodeIndex) const |
Returns a node from the list with node numbers over which the referenced boundary condition is applied. Must be called only for objects with bcType() == GM_BC_NODE. The parameter bcIndex should be a value between 0 and numValues()-1. The nodeIndex parameter should be a value between 0 and numNodes(bcIndex) - 1. More... | |
GmCell * | cell (int bcIndex) const |
Returns the cell over which the referenced boundary condition is applied. Must be called only for objects with bcType() == GM_BC_CELL. The parameter bcIndex should be a value between 0 and numValues()-1;. | |
int | numBoundaryCells (int bcIndex) const |
Returns the number of cells over which the referenced boundary condition is applied. Must be called only for objects with bcType() == GM_BC_EDGE or GM_BC_FACE. The parameter bcIndex should be a value between 0 and numValues()-1;. More... | |
GmCell * | boundaryCell (int bcIndex, int cellIndex) const |
Returns a cell from the list with (cell, border) pairs over which the referenced boundary condition is applied. Must be called only for objects with bcType() == GM_BC_EDGE or GM_BC_FACE. The parameter bcIndex should be a value between 0 and numValues()-1. The cellIndex parameter should be a value between 0 and numBoundaryCells(bcIndex) - 1. | |
int | boundaryCellBorder (int bcIndex, int cellIndex) const |
Returns a border index from the list with (cell, border) pairs over which the referenced boundary condition is applied. Must be called only for objects with bcType() == GM_BC_EDGE or GM_BC_FACE. The parameter bcIndex should be a value between 0 and numValues()-1. The cellIndex parameter should be a value between 0 and numBoundaryCells(bcIndex) - 1. | |
const GmCellBoundary * | boundary (int bcIndex) const |
Returns the boundary over which the referenced boundary condition is applied. Must be called only for objects with bcType() == GM_BC_EDGE, GM_BC_FACE or GM_BC_NODE and will return NULL if the bc was not defined by a boundary object. The parameter bcIndex should be a value between 0 and numValues()-1;. More... | |
GmCellBoundary * | boundary (int bcIndex) |
Overload of the homonimous const version. | |
const GmNodeSet * | nodeSet (int bcIndex) const |
Returns the node set over which the referenced boundary condition is applied. Must be called only for objects with bcType() == GM_BC_NODE and will return NULL if the bc was not definied by a node set. The parameter bcIndex should be a value between 0 and numValues()-1;. More... | |
GmNodeSet * | nodeSet (int bcIndex) |
Overload of the homonimous const version. | |
void | clear () |
Clears BC application point data, including attribute values associated with application point lines. More... | |
void | setNode (int bcIndex, int node) |
Set the node index associated with condition 'bcIndex'. More... | |
void | setNode (int bcIndex, GmCellBoundary *boundary) |
Set the list of nodes associated with condition 'bcIndex' from a boundary object. Can be used only for objects with bcType() == GM_BC_NODE. More... | |
void | setNode (int bcIndex, GmNodeSet *nodeSet) |
Set the list of nodes associated with condition 'bcIndex' from a node set object. Can be used only for objects with bcType() == GM_BC_NODE. More... | |
void | setNode (int bcIndex, int numNodes, int *nodes) |
Set the list of nodes associated with condition 'bcIndex' from a list of nodes. Can be used only for objects with bcType() == GM_BC_NODE. More... | |
void | setCell (int bcIndex, int cell) |
Set the cell index associated with condition 'bcIndex'. Can be used only for objects with bcType() == GM_BC_CELL. More... | |
void | setBoundary (int bcIndex, int cell, int border) |
Set the boundary associated with condition 'bcIndex'. Can be used only for objects with bcType() == GM_BC_EDGE or GM_BC_FACE. More... | |
void | setBoundary (int bcIndex, GmCellBoundary *boundary) |
Set the boundary associated with condition 'bcIndex'. Can be used only for objects with bcType() == GM_BC_EDGE or GM_BC_FACE. More... | |
void | setBoundary (int bcIndex, int numCells, int *cells, int *borders) |
Set the boundary associated with condition 'bcIndex'. Can be used only for objects with bcType() == GM_BC_EDGE or GM_BC_FACE. More... | |
void | reloadNodeBoundaryData (int bcIndex) |
Reloads node information for a NODE boundary condition specified via a border object. Needed for the boundary condition to recognize changes in a border contents. | |
int | addLines (int n=1) |
Adds 'n' new lines to the boundary condition table. More... | |
void | removeLines (int bcIndex, int n=1) |
Removes n boundary condition lines, starting at bcIndex. | |
int | addNodeLine (int node) |
Adds a new boundary condition line to a GM_BC_NODE object, filling the node information. Property values (when tied to application points) should be filled by using accessors. Returns the index of the added line or -1 on error. Equivalent to calling addLines() + setNode(). | |
int | addNodeLine (GmCellBoundary *boundary) |
Adds a new boundary condition line to a GM_BC_NODE object, filling the node information from a boundary object. Property values (when tied to application points) should be filled by using accessors. Returns the index of the added line or -1 on error. Equivalent to calling addLines() + setNode() | |
int | addNodeLine (GmNodeSet *nodeSet) |
Adds a new boundary condition line to a GM_BC_NODE object, filling the node information from a node set object. Property values (when tied to application points) should be filled by using accessors. Returns the index of the added line or -1 on error. Equivalent to calling addLines() + setNode() | |
int | addNodeLine (int numNodes, int *nodes) |
Adds a new boundary condition line to a GM_BC_NODE object, filling the node information from the given node list. Property values (when tied to application points) should be filled by using accessors. Returns the index of the added line or -1 on error. Equivalent to calling addLines() + setNode() | |
int | addCellLine (int cell) |
Adds a new boundary condition line to a GM_BC_CELL object, filling the cell information. Property values (when tied to application points) should be filled by using accessors. Returns the index of the added line or -1 on error. Equivalent to calling addLines() + setCell() | |
int | addBoundaryLine (int cell, int border) |
Adds a new boundary condition line to a GM_BC_EDGE/GM_BC_FACE object, filling the boundary information from a cell/border pair. Property values (when tied to application points) should be filled by using accessors. Returns the index of the added line or -1 on error. Equivalent to calling addLines() + setBoundary() | |
int | addBoundaryLine (GmCellBoundary *boundary) |
Adds a new boundary condition line to a GM_BC_EDGE/GM_BC_FACE object, filling the boundary information. Property values (when tied to application points) should be filled by using accessors. Returns the index of the added line or -1 on error. Equivalent to calling addLines() + setBoundary() | |
int | addBoundaryLine (int numCells, int *cells, int *borders) |
Adds a new boundary condition line to a GM_BC_EDGE/GM_BC_FACE object, filling the boundary information from the given lists of cells/borders. Property values (when tied to application points) should be filled by using accessors. Returns the index of the added line or -1 on error. Equivalent to calling addLines() + setBoundary() | |
void | print (const GmLogCategory &logger, GmLogLevel level, int summary) const |
Prints boundary condition information to the specified logger/level. More... | |
size_t | printMemoryStatistics (const GmLogCategory &logger, GmLogLevel level) const |
Prints memory usage for this boundary condition to the given logger. Returns the used memory as reported by usedMemory() | |
size_t | usedMemory () const |
Returns an estimative of the memory used by the boundary condition in bytes. More... | |
Static Public Member Functions | |
static GmBoundaryCondition * | loadFromTable (LuaTable &tab, GmSimulationData *data, const GmLogCategory &logger) |
Loads a boundary condition object full definition from a Lua table. More... | |
![]() | |
static QString | bcTypeToStr (BcType type) |
Returns a string representing the bc type. | |
static int | strToBcType (QString str) |
Returns the BcType from the provided string or -1 if the type is unknown. | |
Private Attributes | |
QVector< int > | _taggedProperties |
The index in the value set list of the set of properties with tags. | |
QVector< GmBoundaryConditionAccessor * > | _taggedAccessors |
Accessors for tagged properties. Not NULL only for NODE BCs where the tag ignores default or zero values. | |
bool | _hasTaggedFunctionAccessors |
Flag set to true for node BCs with tags that have a ignore clause and function based accessors. | |
Additional Inherited Members | |
![]() | |
enum | BcType { GM_BC_NODE, GM_BC_EDGE, GM_BC_FACE, GM_BC_CELL } |
Boundary condition type defining where a BC is applied (node, edge or face) More... | |
![]() | |
GmBoundaryConditionBase (QString id, QString description, QString type, GmMesh *mesh, BcType bcType) | |
virtual void | clearObjects () |
Aux function used to delete all objects pointed to by _appPointData. All entries are set to 0. | |
virtual QString | msgPrefix () const |
The contents of the %1 argument on the "%1boundary condition" string used on error messages. | |
virtual void | printExtraHeaderInfo (const GmLogCategory &logger, GmLogLevel level) const |
Aux function to print(), giving a chance for derived classes to add additional header data. | |
virtual void | printExtraPropertyValues (const GmLogCategory &logger, GmLogLevel level) const |
Aux function to print(), giving a chance for derived classes to add property values when _appPointUserProperties is false. | |
size_t | appPointUsedMemory () const |
Returns an estimative of the size needed to store application point data. | |
GmValueAccessor * | userValueAccessor (QString propertyId, Unit desiredUnit, const GmLogCategory &logger) const |
Auxilliary function to return a value accessor for a boundary condition property. | |
QString | nodeListStr (int bcIndex, int titleSize, bool align, bool *cropped) const |
Builds a string with the nodes in bcIndex, trying not to surpass titleSize. Returns in cropped whether the string was cropped or not. | |
QString | cellBoundaryListStr (int bcIndex, int titleSize, bool *cropped) const |
Builds a string with the (cell id, border id) pairs in bcIndex, trying not to surpass titleSize Returns in cropped whether the string was cropped or not. | |
bool | mergeLines (LuaTable &tab, int tabSize, const QList< GmValueAccessor * > &acList, int maxLines, const GmLogCategory &logger, QVector< int > &transTable, QVector< int > &countTable) |
bool | parseValueFromVariant (GmValueAccessor *ac, const QVariant &v, GmNanBoxedValue *data, const GmLogCategory &logger) |
Parses the value in v following the exact same rules as GmValueAccessorBase::setValueFromVariant(), storing the parsed values in the data vector. More... | |
int | appPointIndex (int bcIndex, int listIndex) const |
An auxilliary function to support the need in GmBoundaryConditionAccessor to find the cell / node index where the property accessor is applied. More... | |
![]() | |
template<class T > | |
static T * | loadFromBaseTable (LuaTable &tab, GmSimulationData *data, const GmLogCategory &logger, QString msgPrefix="", const QList< GmValueInfo * > &appPointInfoList=QList< GmValueInfo * >()) |
Loads a boundary condition object full definition from a Lua table. More... | |
template<class T > | |
static bool | loadFromDumpFile (T *bc, QString dumpFile, GmSimulationData *data, const GmLogCategory &logger, QString msgPrefix) |
Fill bc with data read from the given dump file. | |
![]() | |
QString | _id |
The boundary condition id (name) | |
QString | _description |
A description of the boundary conditions. | |
QString | _type |
The type of this conditions, to be interpreted by a physics object. | |
GmMesh * | _mesh |
The mesh that this boundary conditions are tied to. | |
BcType | _bcType |
The type of bc. Defines if the bc should be applied over nodes, edges or faces. | |
int | _numValues |
The number of boundary conditions stored in this object. | |
QMap< QString, int > | _userPropertiesMap |
Map translating ids from properties into their position in _userPropertiesData. | |
QVector< GmValueSet * > | _userPropertiesData |
List with set of values for the user properties. | |
QVector< GmValueSet * > | _appPointPropertiesData |
List with set of values tied to the application points. Filled only when those are different from _userPropertiesData. | |
bool | _appPointUserProperties |
Set to true if user properties are tied to application points, false otherwise. | |
QVarLengthArray< BcTaggedPtr, 1 > * | _appPointData |
A vector with size _numValues storing the boundary condition application points. More... | |
A class used to represent a set of boundary conditions of the same type, tied to the same mesh.
Each boundary condition object stores a set of boundary conditions, all sharing the same type and mesh. It also stores a set of properties for each single condition.
Properties are described by a GmValueInfo object and stored in a GmValueSet, thus allowing for us to have boundary condition values expressed by functions. An example can be a surface temperature that changes over time.
The meaning of each of the properties are collectivelly identified by the object type parameter, which should be interpreted by the physics object that will ultimatelly use this boundary condition. A condition also stores where it should be applied. All conditions in the object are tied to the same kind of application point (node, edge, face or cell) as can be queried by a call to bcType().
IMPORTANT: After an object of type GmBoundaryCondition is constructed, it has its basic control parameters in place and also memory allocated for storing the bcs properties, which should be further initialized by calls to setNode()/setBoundary() and by filling properties through the use of accessors.
|
static |
Loads a boundary condition object full definition from a Lua table.
The new object is initialized with the data found in the table. Returns NULL and prints an error message using the supplied logger in case of errors (like an invalid bc definition point node or boundary).
This function expects that a basic validation step has been done elsewhere.
If the 'merge' field in the boundary condition description is equal to 0, no merging attempt will be made. If equal to an integer number greater than 0, a merge attempt will be made using that value as the maximum number of different lines that can be found in the merge attempt. Use a big number for an unbounded number of possible unique values (might be slow). If the field is absent, the default from the 'defBoundaryConditionMerge' field in the set of simulation options will be used (otherwise a value of 0 will be used).
GmBoundaryConditionAccessor * GmBoundaryCondition::propertyAccessor | ( | QString | propertyId, |
Unit | desiredUnit, | ||
const GmLogCategory & | logger | ||
) | const |
Returns an accessor for property values in the desired unit (can be a default unit for no unit conversion).
The returned pointer must be deallocated by the caller. Returns NULL if the property doesn't exists or an accessor can't be created (can't convert to the desired unit, for example).
The logger parameter exists to allow for the accessor to report errors when evaluating a function value, for example.