Pointwise Plugin SDK
Public Member Functions | Protected Attributes | List of all members

The structured boundary class. More...

#include <CaeStrBoundary.h>

+ Collaboration diagram for CaeStrBoundary:

Public Member Functions

 CaeStrBoundary ()
 Default constructor. More...
 
 CaeStrBoundary (const CaeStrBoundary &src)
 Copy constructor. More...
 
 CaeStrBoundary (const CaeStrBoundaryGroup &group, PWP_UINT32 ndx=0)
 Group and boundary index constructor. More...
 
bool data (PWGM_BNDRYDATA &bData, PWGM_CONDDATA &cData) const
 Get both the boundary information and condition data. More...
 
bool data (PWGM_BNDRYDATA &data) const
 Get information about the boundary. More...
 
bool data (PWGM_CONDDATA &data) const
 Gets the boundary's condition data. More...
 
PWP_UINT32 index () const
 Get the boundary's index in the group. More...
 
bool isValid () const
 Determines a boundary's validity. More...
 
CaeStrGridModel model () const
 Gets the structured grid model of which this boundary is a member. More...
 
PWP_UINT32 modelIndex () const
 Get the boundary's model index. More...
 
CaeStrBoundarymoveFirst ()
 Rebinds an instance to the first boundary in the current group. More...
 
CaeStrBoundarymoveFirst (const CaeStrBoundaryGroup &group)
 Rebinds an instance to the first boundary in the group. More...
 
CaeStrBoundarymoveNext ()
 Rebinds an instance to the next boundary in the group. More...
 
CaeStrBoundarymovePrev ()
 Rebinds an instance to the previous boundary in the group. More...
 
CaeStrBoundarymoveTo (const CaeStrBoundaryGroup &group, PWP_UINT32 ndx)
 Rebinds an instance to a specific group and boundary. More...
 
CaeStrBoundarymoveTo (PWP_UINT32 ndx)
 Rebinds an instance to a specific boundary within the current group. More...
 
 operator PWGM_HBNDRY () const
 The PWGM_HBNDRY cast operator. More...
 
bool operator!= (const CaeStrBoundary &rhs) const
 Compares two CaeStrBoundary instances for inequality. More...
 
CaeStrBoundaryoperator++ ()
 Prefix increment to the next boundary in the group. More...
 
CaeStrBoundary operator++ (int)
 Postfix increment to the next boundary in the group. More...
 
CaeStrBoundaryoperator-- ()
 Prefix decrement to the previous boundary in the group. More...
 
CaeStrBoundary operator-- (int)
 Postfix decrement to the previous boundary in the group. More...
 
bool operator< (const CaeStrBoundary &rhs) const
 Compares the relative order of two CaeStrBoundary instances. More...
 
CaeStrBoundaryoperator= (const CaeStrBoundary &rhs)
 Assignment operator. More...
 
bool operator== (const CaeStrBoundary &rhs) const
 Compares two CaeStrBoundary instances for equality. More...
 
bool operator> (const PWGM_HBNDRY &rhs)
 Compares the relative order of two CaeStrBoundary instances. More...
 
 ~CaeStrBoundary ()
 Destructor. More...
 

Protected Attributes

const CaeStrBoundaryGroupgroup_
 The owning boundary group. More...
 
PWP_UINT32 groupNdx_
 The current index in the group's index space. More...
 
PWGM_HBNDRY h_
 The bound PWGM_HBNDRY. More...
 

Detailed Description

The structured boundary class.

The CaeStrBoundary class represents a single, ijk-structured grid model boundary. The boundaries are indexed starting from 0 to CaeStrBoundaryGroup::elementCount() - 1.

A CaeStrBoundary object is aware of its relative position in its boundary group. As a result, a given boundary object can be moved (iterated) to its previous or next neighbor boundary. It can also be moved to the first boundary or to a boundary at a given index. After being moved, a CaeStrBoundary object will return information about the grid boundary at its current position.

Sample Usage:

The following snippets are extracted from the structured XML sample plugin (CaeStrXMLCPP).

During the execution of the CaeStrXMLCPP::writeBlock() method, the CaeStrXMLCPP plugin writes a block's boundaries with a call to the CaeStrXMLCPP::writeBlkBoundaries() method. First, it writes an XML <boundaries> tag. Then it moves through the boundaries one by one and calls the CaeStrXMLCPP::writeBoundaryAndConditionData() method. Finally, a closing </boundaries> tag is written.

bool
CaeStrXMLCPP::writeBlkBoundaries(const CaeStrBlock &block)
{
fprintf(fp(), "%s<boundaries cnt='%lu'>\n", tabs(),
(unsigned long)block.boundaryCount());
++tabs_;
CaeStrBoundary bndry(block);
CaeCondition condData;
while (bndry.data(bData, condData)) {
writeBoundaryAndConditionData(bndry.modelIndex(), bData, condData);
++bndry;
}
--tabs_;
fprintf(fp(), "%s</boundaries>\n", tabs());
return true;
}

CaeStrXMLCPP::writeBoundaryAndConditionData() writes an XML <boundary> tag. Next, the boundary's range and condition are exported with calls to CaeStrXMLCPP::writeRange() and CaeStrXMLCPP::writeConditionData(). Finally, a closing </boundary> tag is written.

void
CaeStrXMLCPP::writeBoundaryAndConditionData(PWP_UINT32 bndryId,
const PWGM_BNDRYDATA &bData, const CaeCondition &condData)
{
const char *name = (bData.name ? bData.name : "");
CaeStrBlock bndryBlock(bData.block);
fprintf(fp(), "%s<boundary name='%s' blk='%lu' face='%s' id='%lu'>\n",
tabs(), name, (unsigned long)bndryBlock.index(), faceIdStr[bData.face],
(unsigned long)bndryId);
++tabs_;
writeRange(bData.range);
writeConditionData(condData);
--tabs_;
fprintf(fp(), "%s</boundary>\n", tabs());
}

CaeStrXMLCPP::writeRange() writes a self-closed XML <range /> tag.

void
CaeStrXMLCPP::writeRange(const PWGM_STR_RANGE &range)
{
if (isDimension3D()) {
fprintf(fp(), "%s<range ijkmin='%lu %lu %lu' ijkmax='%lu %lu %lu' />\n",
tabs(), (unsigned long)range.beg.i, (unsigned long)range.beg.j,
(unsigned long)range.beg.k, (unsigned long)range.end.i,
(unsigned long)range.end.j, (unsigned long)range.end.k);
}
else {
fprintf(fp(),
"%s<range ijmin='%lu %lu' ijmax='%lu %lu' />\n",
tabs(), (unsigned long)range.beg.i, (unsigned long)range.beg.j,
(unsigned long)range.end.i, (unsigned long)range.end.j);
}
}

CaeStrXMLCPP::writeConditionData() writes a self-closed XML <condition /> tag.

void
CaeStrXMLCPP::writeConditionData(const CaeCondition &condData)
{
fprintf(fp(), "%s<condition name='%s' id='%ld' type='%s' typeid='%ld' />\n",
tabs(), condData.name(), (long)condData.id(), condData.typeName(),
(long)condData.typeId());
}

Definition at line 62 of file CaeStrBoundary.h.

Constructor & Destructor Documentation

◆ CaeStrBoundary() [1/3]

CaeStrBoundary::CaeStrBoundary ( )
inline

Default constructor.

Constructs an invalid boundary.

Note
The boundary can be made valid using moveTo() or moveFirst().
See also
moveTo(), moveFirst(), moveNext(), movePrev()

Definition at line 71 of file CaeStrBoundary.h.

References h_.

◆ CaeStrBoundary() [2/3]

CaeStrBoundary::CaeStrBoundary ( const CaeStrBoundaryGroup group,
PWP_UINT32  ndx = 0 
)
inline

Group and boundary index constructor.

Constructs an structured boundary object bound to the boundary at the specified index.

Parameters
groupThe owning structured boundary group.
ndxThe boundary's index within the group.
See also
CaeStrGridModel, CaeStrBlock

Definition at line 83 of file CaeStrBoundary.h.

References h_, and moveTo().

◆ CaeStrBoundary() [3/3]

CaeStrBoundary::CaeStrBoundary ( const CaeStrBoundary src)
inline

Copy constructor.

Binds this boundary to the same boundary as src.

Parameters
srcAn boundary instance.

Definition at line 93 of file CaeStrBoundary.h.

References group_, groupNdx_, and h_.

◆ ~CaeStrBoundary()

CaeStrBoundary::~CaeStrBoundary ( )
inline

Destructor.

Definition at line 100 of file CaeStrBoundary.h.

Member Function Documentation

◆ data() [1/3]

bool CaeStrBoundary::data ( PWGM_BNDRYDATA bData,
PWGM_CONDDATA cData 
) const
inline

Get both the boundary information and condition data.

Parameters
bDataThe PWGM_BNDRYDATA buffer.
cDataThe PWGM_CONDDATA buffer.
Returns
true if successful.
Note
If both pieces of data are needed, this call is more efficent than calling the individual data() methods.

Definition at line 155 of file CaeStrBoundary.h.

References h_, PWGM_HBNDRY_ID, PWGM_HBNDRY_MODEL, and PwModNdxBoundaryAndCondition().

◆ data() [2/3]

bool CaeStrBoundary::data ( PWGM_BNDRYDATA data) const
inline

Get information about the boundary.

Parameters
dataThe PWGM_BNDRYDATA buffer.
Returns
true if successful.

Definition at line 134 of file CaeStrBoundary.h.

References h_, and PwBoundary().

Referenced by data().

◆ data() [3/3]

bool CaeStrBoundary::data ( PWGM_CONDDATA data) const
inline

Gets the boundary's condition data.

Parameters
dataThe PWGM_CONDDATA buffer.
Returns
true if successful.

Definition at line 143 of file CaeStrBoundary.h.

References data(), h_, and PwBndryCondition().

◆ index()

PWP_UINT32 CaeStrBoundary::index ( ) const
inline

Get the boundary's index in the group.

Returns
The boundary's index in the group's index space.
Note
The values returned will be contiguous in the range of 0 to CaeStrBoundaryGroup::boundaryCount() - 1.

Definition at line 114 of file CaeStrBoundary.h.

References groupNdx_.

◆ isValid()

bool CaeStrBoundary::isValid ( ) const
inline

Determines a boundary's validity.

Returns
true if the boundary is valid.

Definition at line 162 of file CaeStrBoundary.h.

References h_, and PWGM_HBNDRY_ISVALID.

◆ model()

CaeStrGridModel CaeStrBoundary::model ( ) const
inline

Gets the structured grid model of which this boundary is a member.

Definition at line 104 of file CaeStrBoundary.h.

References h_, and PWGM_HBNDRY_MODEL.

◆ modelIndex()

PWP_UINT32 CaeStrBoundary::modelIndex ( ) const
inline

Get the boundary's model index.

Returns
The boundary's index in the grid model's index space.
Note
The values returned are in the range of 0 to CaeStrGridModel::boundaryCount() - 1. If the grid model contains 2 or more blocks, the values will be a subset of the full range.

Definition at line 125 of file CaeStrBoundary.h.

References h_, and PWGM_HBNDRY_ID.

◆ moveFirst() [1/2]

CaeStrBoundary& CaeStrBoundary::moveFirst ( )
inline

Rebinds an instance to the first boundary in the current group.

Returns
A self reference.
Note
If isValid() is false, the returned boundary will be invalid.
See also
moveTo(), movePrev(), moveNext()

Definition at line 226 of file CaeStrBoundary.h.

References CaeStrBoundaryGroup::enumBoundaries(), group_, groupNdx_, and h_.

◆ moveFirst() [2/2]

CaeStrBoundary& CaeStrBoundary::moveFirst ( const CaeStrBoundaryGroup group)
inline

Rebinds an instance to the first boundary in the group.

Parameters
groupThe boundary group.
Returns
A self reference.
Note
Equivalent to calling moveTo(group, 0).
See also
moveTo(), movePrev(), moveNext()

Definition at line 215 of file CaeStrBoundary.h.

References group_, and moveTo().

◆ moveNext()

CaeStrBoundary& CaeStrBoundary::moveNext ( )
inline

Rebinds an instance to the next boundary in the group.

Returns
A self reference.
Note
If already on the last boundary, the boundary will become invalid.
See also
moveTo(), moveFirst(), movePrev(), isValid()

Definition at line 241 of file CaeStrBoundary.h.

References groupNdx_, and moveTo().

◆ movePrev()

CaeStrBoundary& CaeStrBoundary::movePrev ( )
inline

Rebinds an instance to the previous boundary in the group.

Returns
A self reference.
Note
If already on the first boundary, the boundary will become invalid.
See also
moveTo(), moveFirst(), movePrev(), moveNext(), isValid()

Definition at line 277 of file CaeStrBoundary.h.

References groupNdx_, and moveTo().

◆ moveTo() [1/2]

CaeStrBoundary& CaeStrBoundary::moveTo ( const CaeStrBoundaryGroup group,
PWP_UINT32  ndx 
)
inline

Rebinds an instance to a specific group and boundary.

Parameters
groupThe boundary group.
ndxThe boundary's index in the group's index space.
Returns
A self reference.
Note
If ndx is not a valid index, the boundary will become invalid.
See also
moveFirst(), movePrev(), moveNext(), isValid()

Definition at line 187 of file CaeStrBoundary.h.

References group_.

Referenced by CaeStrBoundary(), moveFirst(), moveNext(), movePrev(), operator++(), and operator--().

◆ moveTo() [2/2]

CaeStrBoundary& CaeStrBoundary::moveTo ( PWP_UINT32  ndx)
inline

Rebinds an instance to a specific boundary within the current group.

Parameters
ndxThe boundary's index in the group's index space.
Returns
A self reference.
Note
If isValid() is false, the returned boundary will be invalid.
If ndx is not a valid index, the boundary will become invalid.
See also
moveFirst(), movePrev(), moveNext(), isValid()

Definition at line 200 of file CaeStrBoundary.h.

References CaeStrBoundaryGroup::enumBoundaries(), group_, groupNdx_, and h_.

◆ operator PWGM_HBNDRY()

CaeStrBoundary::operator PWGM_HBNDRY ( ) const
inline

The PWGM_HBNDRY cast operator.

Definition at line 356 of file CaeStrBoundary.h.

References h_.

◆ operator!=()

bool CaeStrBoundary::operator!= ( const CaeStrBoundary rhs) const
inline

Compares two CaeStrBoundary instances for inequality.

Returns
true if each instance is bound to a different grid boundary or only one of the boundaries is invalid.

Definition at line 324 of file CaeStrBoundary.h.

◆ operator++() [1/2]

CaeStrBoundary& CaeStrBoundary::operator++ ( )
inline

Prefix increment to the next boundary in the group.

Returns
A self reference.
Note
Equivalent to calling moveNext().
If already on the last boundary, the boundary will become invalid.
See also
moveTo(), moveFirst(), movePrev(), isValid()

Definition at line 253 of file CaeStrBoundary.h.

References groupNdx_, and moveTo().

◆ operator++() [2/2]

CaeStrBoundary CaeStrBoundary::operator++ ( int  )
inline

Postfix increment to the next boundary in the group.

Returns
A copy of the boundary before it was moved.
Note
If already on the last boundary, the boundary will become invalid.
See also
moveTo(), moveFirst(), movePrev(), moveNext(), isValid()

Definition at line 264 of file CaeStrBoundary.h.

References groupNdx_, and moveTo().

◆ operator--() [1/2]

CaeStrBoundary& CaeStrBoundary::operator-- ( )
inline

Prefix decrement to the previous boundary in the group.

Returns
A self reference.
Note
Equivalent to calling movePrev().
If already on the first boundary, the boundary will become invalid.
See also
moveTo(), moveFirst(), movePrev(), moveNext(), isValid()

Definition at line 289 of file CaeStrBoundary.h.

References groupNdx_, and moveTo().

◆ operator--() [2/2]

CaeStrBoundary CaeStrBoundary::operator-- ( int  )
inline

Postfix decrement to the previous boundary in the group.

Returns
A copy of the boundary before it was moved.
Note
If already on the first boundary, the boundary will become invalid.
See also
moveTo(), moveFirst(), movePrev(), moveNext(), isValid()

Definition at line 300 of file CaeStrBoundary.h.

References groupNdx_, and moveTo().

◆ operator<()

bool CaeStrBoundary::operator< ( const CaeStrBoundary rhs) const
inline

Compares the relative order of two CaeStrBoundary instances.

Returns
true if *this is ordered less than rhs.

Definition at line 336 of file CaeStrBoundary.h.

References group_, and h_.

◆ operator=()

CaeStrBoundary& CaeStrBoundary::operator= ( const CaeStrBoundary rhs)
inline

Assignment operator.

Rebind this boundary to the same boundary as rhs.

Parameters
rhsA boundary instance.
Returns
A self reference.

Definition at line 172 of file CaeStrBoundary.h.

References group_, groupNdx_, and h_.

◆ operator==()

bool CaeStrBoundary::operator== ( const CaeStrBoundary rhs) const
inline

Compares two CaeStrBoundary instances for equality.

Returns
true if both instances are bound to the same grid boundary or both boundaries are invalid.

Definition at line 315 of file CaeStrBoundary.h.

References group_, and h_.

◆ operator>()

bool CaeStrBoundary::operator> ( const PWGM_HBNDRY rhs)
inline

Compares the relative order of two CaeStrBoundary instances.

Returns
true if *this is ordered greater than rhs.

Definition at line 350 of file CaeStrBoundary.h.

Member Data Documentation

◆ group_

const CaeStrBoundaryGroup* CaeStrBoundary::group_
protected

The owning boundary group.

Definition at line 362 of file CaeStrBoundary.h.

Referenced by CaeStrBoundary(), moveFirst(), moveTo(), operator<(), operator=(), and operator==().

◆ groupNdx_

PWP_UINT32 CaeStrBoundary::groupNdx_
protected

The current index in the group's index space.

Definition at line 364 of file CaeStrBoundary.h.

Referenced by CaeStrBoundary(), index(), moveFirst(), moveNext(), movePrev(), moveTo(), operator++(), operator--(), and operator=().

◆ h_

PWGM_HBNDRY CaeStrBoundary::h_
protected

The documentation for this class was generated from the following file:
PWGM_INDEX3::j
PWP_INT32 j
j-coordinate used for 3D and 2D grids
Definition: apiGridModel.h:890
PWP_UINT32
unsigned int PWP_UINT32
32-bit unsigned integer
Definition: apiPWP.h:210
PWGM_BNDRYDATA::block
PWGM_HBLOCK block
boundary block
Definition: apiGridModel.h:982
PWGM_INDEX3::i
PWP_INT32 i
i-coordinate used for 3D and 2D grids
Definition: apiGridModel.h:889
CaeStrBlock
The structured block class.
Definition: CaeStrBlock.h:72
CaeCondition::name
const char * name() const
Gets the user assigned condition name.
Definition: CaeGridModel.h:497
PWGM_STR_RANGE::end
PWGM_INDEX3 end
ending index
Definition: apiGridModel.h:911
PWGM_BNDRYDATA::range
PWGM_STR_RANGE range
boundary ijk range
Definition: apiGridModel.h:984
PWGM_BNDRYDATA::face
PWGM_FACE_ID face
boundary face id
Definition: apiGridModel.h:983
PWGM_INDEX3::k
PWP_INT32 k
k-coordinate used for 3D grids only
Definition: apiGridModel.h:891
PWGM_BNDRYDATA
Structured grid boundary data type.
Definition: apiGridModel.h:980
PWGM_STR_RANGE::beg
PWGM_INDEX3 beg
begining index
Definition: apiGridModel.h:910
CaeStrBoundary
The structured boundary class.
Definition: CaeStrBoundary.h:62
PWGM_BNDRYDATA::name
const char * name
boundary name
Definition: apiGridModel.h:981
CaeCondition::typeName
const char * typeName() const
Gets the solver defined condition type name.
Definition: CaeGridModel.h:513
CaeCondition::typeId
PWP_UINT32 typeId() const
Gets the solver defined condition type id value.
Definition: CaeGridModel.h:521
CaeCondition::id
PWP_UINT32 id() const
Gets the user assigned condition id value.
Definition: CaeGridModel.h:505
CaeCondition
The volume and boundary condition data class.
Definition: CaeGridModel.h:450
PWGM_STR_RANGE
Structured grid ijk range data type.
Definition: apiGridModel.h:909
CaeStrBoundaryGroup::boundaryCount
PWP_UINT32 boundaryCount() const
Get the number of boundaries in the group.
Definition: CaeStrBoundaryGroup.h:57