Pointwise Plugin SDK
CaeUnsPatch.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * CaeUnsPatch class
4  *
5  * (C) 2021 Cadence Design Systems, Inc. All rights reserved worldwide.
6  *
7  ***************************************************************************/
8 
9 #if !defined(PWGM_HIDE_UNSTRUCTURED_API)
10 
11 #ifndef _CAEUNSPATCH_H_
12 #define _CAEUNSPATCH_H_
13 
14 
15 #include "apiGridModel.h"
16 #include "apiPWP.h"
17 #include "CaeUnsGridModel.h"
18 
19 
70 public:
71 
73 
79  PWGM_HDOMAIN_SET_INVALID(h_);
80  }
81 
83 
87  CaeUnsPatch(PWGM_HDOMAIN domain) : h_(domain) {
88  }
89 
91 
95  CaeUnsPatch(const CaeUnsPatch &src) {
96  h_ = src.h_;
97  }
98 
100 
107  moveTo(model, ndx);
108  }
109 
111  virtual ~CaeUnsPatch() {
112  }
113 
117  }
118 
120 
123  PWP_UINT32 index() const {
124  return PWGM_HDOMAIN_ID(h_);
125  }
126 
128 
140  bool condition(PWGM_CONDDATA &data) const {
141  return 0 != PwDomCondition(h_, &data);
142  }
143 
146  bool isValid() const {
147  return PWGM_HDOMAIN_ISVALID(h_);
148  }
149 
151 
157  h_ = rhs.h_;
158  return *this;
159  }
160 
162 
168  h_ = domain;
169  return *this;
170  }
171 
173 
181  h_ = PwModEnumDomains(model, ndx);
182  return *this;
183  }
184 
186 
193  return moveTo(model, 0);
194  }
195 
197 
203  h_ = moveTo(PWGM_HDOMAIN_H(h_), index() + 1);
204  return *this;
205  }
206 
208 
214  CaeUnsPatch& operator++() { // pre incr to next patch
215  return moveNext();
216  }
217 
219 
224  CaeUnsPatch operator++(int) { // post incr to next patch
225  CaeUnsPatch ret = *this;
226  operator++();
227  return ret;
228  }
229 
231 
236  CaeUnsPatch& movePrev() { // move to previous patch
237  h_ = moveTo(PWGM_HDOMAIN_H(h_), index() - 1);
238  return *this;
239  }
240 
242 
248  CaeUnsPatch& operator--() { // pre decr to previous patch
249  return movePrev();
250  }
251 
253 
258  CaeUnsPatch operator--(int) { // post decr to previous patch
259  CaeUnsPatch ret = *this;
260  operator--();
261  return ret;
262  }
263 
265  operator PWGM_HDOMAIN() const {
266  return h_;
267  }
268 
269 protected:
270 
272  virtual PWP_UINT32 elementCountImpl(PWGM_ELEMCOUNTS *pDetails = 0) const {
273  return PwDomElementCount(h_, pDetails);
274  }
275 
276  virtual PWGM_HELEMENT enumElementsImpl(PWP_UINT32 ndx) const {
277  return PwDomEnumElements(h_, ndx);
278  }
280 
281 protected:
282 
284 };
285 
286 #endif // _CAEUNSPATCH_H_
287 
288 #endif // PWGM_HIDE_UNSTRUCTURED_API
PWGM_HELEMENT
Grid element handle declaration.
Definition: apiGridModel.h:427
PwDomElementCount
PWP_UINT32 PwDomElementCount(PWGM_HDOMAIN domain, PWGM_ELEMCOUNTS *pCounts)
Get the number of domain elements.
Definition: apiGridModel.cxx:325
PwModEnumDomains
PWGM_HDOMAIN PwModEnumDomains(PWGM_HGRIDMODEL model, PWP_UINT32 ndx)
Sequentially enumerate the model domain elements.
Definition: apiGridModel.cxx:234
CaeUnsPatch::operator=
CaeUnsPatch & operator=(PWGM_HDOMAIN domain)
Assignment operator.
Definition: CaeUnsPatch.h:167
CaeUnsPatch::model
CaeUnsGridModel model() const
Gets the unstructured grid model of which this patch is a member.
Definition: CaeUnsPatch.h:115
CaeUnsPatch::CaeUnsPatch
CaeUnsPatch()
Default constructor.
Definition: CaeUnsPatch.h:78
PWP_UINT32
unsigned int PWP_UINT32
32-bit unsigned integer
Definition: apiPWP.h:210
PWGM_HDOMAIN
An opaque handle to a grid domain element.
Definition: apiGridModel.h:372
CaeUnsGridModel
The unstructured grid model class.
Definition: CaeUnsGridModel.h:176
CaeUnsPatch::isValid
bool isValid() const
Determines a patch's validity.
Definition: CaeUnsPatch.h:146
PWGM_HDOMAIN_ISVALID
#define PWGM_HDOMAIN_ISVALID(h)
returns non-zero value if handle is valid
Definition: apiGridModel.h:374
CaeUnsPatch::index
PWP_UINT32 index() const
Get the patch's index.
Definition: CaeUnsPatch.h:123
CaeUnsPatch::h_
PWGM_HDOMAIN h_
The bound PWGM_HDOMAIN.
Definition: CaeUnsPatch.h:283
CaeUnsPatch
The unstructured patch class.
Definition: CaeUnsPatch.h:69
CaeUnsPatch::movePrev
CaeUnsPatch & movePrev()
Rebinds an instance to the previous patch in a model.
Definition: CaeUnsPatch.h:236
apiGridModel.h
Pointwise Grid Model API Specification (PWGM-API)
PwDomEnumElements
PWGM_HELEMENT PwDomEnumElements(PWGM_HDOMAIN domain, PWP_UINT32 ndx)
Sequentially enumerate the domain elements.
Definition: apiGridModel.cxx:333
CaeUnsElementGroup
The unstructured element group class.
Definition: CaeUnsElementGroup.h:44
PWGM_HDOMAIN_ID
#define PWGM_HDOMAIN_ID(h)
gets the domain's guid from the handle
Definition: apiGridModel.h:392
CaeUnsPatch::operator--
CaeUnsPatch & operator--()
Prefix decrement to the previous patch in a model.
Definition: CaeUnsPatch.h:248
PwDomCondition
PWP_BOOL PwDomCondition(PWGM_HDOMAIN domain, PWGM_CONDDATA *pCondData)
Get the domain condition data.
Definition: apiGridModel.cxx:341
PWGM_HDOMAIN_H
#define PWGM_HDOMAIN_H(h)
gets the element's parent PWGM_HGRIDMODEL handle
Definition: apiGridModel.h:390
CaeUnsElementGroup::enumElementsImpl
virtual PWGM_HELEMENT enumElementsImpl(PWP_UINT32 ndx) const =0
Get an element in the group.
PWGM_ELEMCOUNTS
Element count information.
Definition: apiGridModel.h:774
CaeUnsPatch::moveTo
CaeUnsPatch & moveTo(const CaeUnsGridModel &model, PWP_UINT32 ndx)
Rebinds an instance to a specific model patch.
Definition: CaeUnsPatch.h:180
CaeUnsPatch::CaeUnsPatch
CaeUnsPatch(const CaeUnsGridModel &model, PWP_UINT32 ndx=0)
Model and patch index constructor.
Definition: CaeUnsPatch.h:106
CaeUnsPatch::moveFirst
CaeUnsPatch & moveFirst(const CaeUnsGridModel &model)
Rebinds an instance to the first patch in a model.
Definition: CaeUnsPatch.h:192
CaeUnsPatch::moveNext
CaeUnsPatch & moveNext()
Rebinds an instance to the next patch in a model.
Definition: CaeUnsPatch.h:202
CaeUnsPatch::operator=
CaeUnsPatch & operator=(const CaeUnsPatch &rhs)
Assignment operator.
Definition: CaeUnsPatch.h:156
PWGM_CONDDATA
Condition descriptor data type.
Definition: apiGridModel.h:644
CaeUnsGridModel.h
CaeUnsPatch::operator++
CaeUnsPatch & operator++()
Prefix increment to the next patch in a model.
Definition: CaeUnsPatch.h:214
apiPWP.h
Pointwise Plugin API (PWP-API)
CaeUnsPatch::CaeUnsPatch
CaeUnsPatch(const CaeUnsPatch &src)
Copy constructor.
Definition: CaeUnsPatch.h:95
CaeUnsPatch::condition
bool condition(PWGM_CONDDATA &data) const
Get the patch's condition data.
Definition: CaeUnsPatch.h:140
CaeUnsElementGroup::elementCountImpl
virtual PWP_UINT32 elementCountImpl(PWGM_ELEMCOUNTS *pDetails) const =0
Get the number of elements in the group.
CaeUnsPatch::operator++
CaeUnsPatch operator++(int)
Postfix increment to the next patch in a model.
Definition: CaeUnsPatch.h:224
CaeUnsPatch::operator--
CaeUnsPatch operator--(int)
Postfix decrement to the previous patch in a model.
Definition: CaeUnsPatch.h:258
CaeUnsPatch::CaeUnsPatch
CaeUnsPatch(PWGM_HDOMAIN domain)
Domain handle constructor.
Definition: CaeUnsPatch.h:87
CaeUnsPatch::~CaeUnsPatch
virtual ~CaeUnsPatch()
Destructor.
Definition: CaeUnsPatch.h:111