Pointwise Plugin SDK
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
CaeStrGridModel.cxx
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * CaeStrGridModel class
4  *
5  * (C) 2021 Cadence Design Systems, Inc. All rights reserved worldwide.
6  *
7  ***************************************************************************/
8 
9 #if !defined(PWGM_HIDE_STRUCTURED_API)
10 
11 #include "apiGridModel.h"
12 #include "apiPWP.h"
13 
14 #include "CaeGridModel.h"
15 #include "CaeStrGridModel.h"
16 
17 
18 //***************************************************************************
19 //***************************************************************************
20 //***************************************************************************
21 
23  CaeGridModel(model)
24 {
25 }
26 
28  CaeGridModel(src.model_)
29 {
30 }
31 
33 {
34 }
35 
36 
37 
38 static PWGM_INDEX3
39 ndxMapperCB(const PWGM_INDEX3 pwgmNdx, void *data)
40 {
42  return handler->mapIndex(pwgmNdx);
43 }
44 
45 bool
47 {
48  return 0 != PwModCustomIndex3SchemeReady(model_, ndxMapperCB, &handler);
49 }
50 
51 
52 bool
54 {
55  return 0 != PwXform2to3(&x2, &x3);
56 }
57 
58 bool
60 {
61  return 0 != PwXform3to2(&x3, &x2);
62 }
63 
66 {
67  return PwXformApply(&x3, ijk);
68 }
69 
72  localAxis, bool *pFlipped)
73 {
74  PWP_BOOL locFlipped;
75  PWGM_ENUM_IJK ret = PwXformFollows(&x3, localAxis, &locFlipped);
76  if (0 != pFlipped) {
77  *pFlipped = (0 != locFlipped);
78  }
79  return ret;
80 }
81 
84  ijk)
85 {
86  return PwXform2Apply(&x2, ijk);
87 }
88 
91  localAxis, bool *pFlipped)
92 {
93  PWP_BOOL locFlipped;
94  PWGM_ENUM_IJK ret = PwXform2Follows(&x2, localAxis, &locFlipped);
95  if (0 != pFlipped) {
96  *pFlipped = (0 != locFlipped);
97  }
98  return ret;
99 }
100 
101 bool
103 {
104  return 0 != PwInRange(ijk, &range);
105 }
106 
107 
108 // data layout for PWGM_HBNDRY:
109 // struct PWGM_HBNDRY {
110 // PWGM_HGRIDMODEL hP;
111 // PWP_UINT32 id;
112 // }
113 
114 bool
115 operator==(const PWGM_HBNDRY &h1, const PWGM_HBNDRY &h2)
116 {
117  // for speed, compare ids first. This assumes that most compares will
118  // differ in ids. Only if ids are the same will the remaining, more
119  // expensive compares be performed.
120  return (PWGM_HBNDRY_ID(h1) == PWGM_HBNDRY_ID(h2)) && // .id
121  (PWGM_HBNDRY_OUT_GMIMPL(h1) == PWGM_HBNDRY_OUT_GMIMPL(h2)); // .hP
122 }
123 
124 bool
125 operator!=(const PWGM_HBNDRY &h1, const PWGM_HBNDRY &h2)
126 {
127  return !(h1 == h2);
128 }
129 
130 bool
131 operator<(const PWGM_HBNDRY &h1, const PWGM_HBNDRY &h2)
132 {
133  // for speed, compare ids first. This assumes that most compares will
134  // differ in ids. Only if ids are the same will the remaining, more
135  // expensive compares be performed.
136  if (PWGM_HBNDRY_ID(h1) < PWGM_HBNDRY_ID(h2)) { // .id
137  return true;
138  }
139  else if (PWGM_HBNDRY_ID(h1) > PWGM_HBNDRY_ID(h2)) { // .id
140  return false;
141  }
142  else if (PWGM_HBNDRY_OUT_GMIMPL(h1) < PWGM_HBNDRY_OUT_GMIMPL(h2)) { // parent.hP
143  return true;
144  }
145  return false; // PWGM_HBNDRY_OUT_GMIMPL(h1) >= PWGM_HBNDRY_OUT_GMIMPL(h2)
146 }
147 
148 bool
149 operator>(const PWGM_HBNDRY &h1, const PWGM_HBNDRY &h2)
150 {
151  return (h1 != h2) && !(h1 < h2);
152 }
153 
154 
155 // data layout for PWGM_HCNXN:
156 // struct PWGM_HCNXN {
157 // PWGM_HGRIDMODEL hP;
158 // PWP_UINT32 id;
159 // }
160 
161 bool
162 operator==(const PWGM_HCNXN &h1, const PWGM_HCNXN &h2)
163 {
164  // for speed, compare ids first. This assumes that most compares will
165  // differ in ids. Only if ids are the same will the remaining, more
166  // expensive compares be performed.
167  return (PWGM_HCNXN_ID(h1) == PWGM_HCNXN_ID(h2)) && // .id
168  (PWGM_HCNXN_OUT_GMIMPL(h1) == PWGM_HCNXN_OUT_GMIMPL(h2)); // .hP
169 }
170 
171 bool
172 operator!=(const PWGM_HCNXN &h1, const PWGM_HCNXN &h2)
173 {
174  return !(h1 == h2);
175 }
176 
177 bool
178 operator<(const PWGM_HCNXN &h1, const PWGM_HCNXN &h2)
179 {
180  // for speed, compare ids first. This assumes that most compares will
181  // differ in ids. Only if ids are the same will the remaining, more
182  // expensive compares be performed.
183  if (PWGM_HCNXN_ID(h1) < PWGM_HCNXN_ID(h2)) { // .id
184  return true;
185  }
186  else if (PWGM_HCNXN_ID(h1) > PWGM_HCNXN_ID(h2)) { // .id
187  return false;
188  }
189  else if (PWGM_HCNXN_OUT_GMIMPL(h1) < PWGM_HCNXN_OUT_GMIMPL(h2)) { // parent.hP
190  return true;
191  }
192  return false; // PWGM_HCNXN_OUT_GMIMPL(h1) >= PWGM_HCNXN_OUT_GMIMPL(h2)
193 }
194 
195 bool
196 operator>(const PWGM_HCNXN &h1, const PWGM_HCNXN &h2)
197 {
198  return (h1 != h2) && !(h1 < h2);
199 }
200 
201 #endif // PWGM_HIDE_STRUCTURED_API
The 2D transform matrix data type.
Definition: apiGridModel.h:903
bool customIndexSchemeReady(CaeStrCustomIndexHandler &handler) const
Notify export framework that custom index mapper is ready for use.
The 3D transform matrix data type.
Definition: apiGridModel.h:892
static bool xform2to3(const PWGM_INDEX_XFORM2 &x2, PWGM_INDEX_XFORM &x3)
Up converts an ij transform to an equivalent ijk transform.
Pointwise Plugin API (PWP-API)
PWP_BOOL PwXform3to2(const PWGM_INDEX_XFORM *pX3, PWGM_INDEX_XFORM2 *pX2)
Convert a 3D transform matrix to it&#39;s 2D equivalent.
bool operator==(const PWGM_HBLOCK &h1, const PWGM_HBLOCK &h2)
PWGM_HGRIDMODEL model_
The bound PWGM_HGRIDMODEL.
Definition: CaeGridModel.h:145
Pointwise Grid Model API Specification (PWGM-API)
#define PWGM_HBNDRY_ID(h)
gets the boundary&#39;s guid from the handle
Definition: apiGridModel.h:475
PWP_BOOL PwModCustomIndex3SchemeReady(PWGM_HGRIDMODEL model, PWGM_INDEX3MAPPERCB cb, void *data)
Notifys the Pointwise export framework that the custom, structured index3 map is ready.
PWGM_ENUM_IJK
IJK component type ids.
Definition: apiGridModel.h:986
An opaque handle to a structured block boundary.
Definition: apiGridModel.h:457
PWP_BOOL PwInRange(PWGM_INDEX3 ijk, const PWGM_STR_RANGE *pRange)
Determines if an PWGM_INDEX3 is within a PWGM_STR_RANGE.
PWGM_INDEX3 PwXform2Apply(const PWGM_INDEX_XFORM2 *pX2, PWGM_INDEX3 ijk)
Apply a PWGM_INDEX_XFORM2 transform to a PWGM_INDEX3 value.
An opaque handle to a structured, inter-block connection.
Definition: apiGridModel.h:482
static bool xform3to2(const PWGM_INDEX_XFORM &x3, PWGM_INDEX_XFORM2 &x2)
Down converts a ijk transform to an equivalent ij transform.
virtual ~CaeStrGridModel()
Destructor.
bool operator!=(const PWGM_HBLOCK &h1, const PWGM_HBLOCK &h2)
static PWGM_ENUM_IJK xform2Follows(const PWGM_INDEX_XFORM2 &x2, PWGM_ENUM_IJK localAxis, bool *pFlipped=0)
Determines which axes are parallel in a transformed ij system.
#define PWGM_HCNXN_ID(h)
gets the connection&#39;s guid from the handle
Definition: apiGridModel.h:500
static PWGM_INDEX3 xformApply(const PWGM_INDEX_XFORM &x3, const PWGM_INDEX3 &ijk)
Apply an ijk transform to an ijk connection index.
Structured grid ijk range data type.
Definition: apiGridModel.h:880
virtual PWGM_INDEX3 mapIndex(const PWGM_INDEX3 pwgmNdx)=0
Pure virtual index mapping method.
Structured grid ijk index data type.
Definition: apiGridModel.h:859
int PWP_BOOL
logical value
Definition: apiPWP.h:303
The grid model base class.
Definition: CaeGridModel.h:46
static PWGM_INDEX3 xform2Apply(const PWGM_INDEX_XFORM2 &x2, const PWGM_INDEX3 &ijk)
Apply a transform to an ij connection index.
CaeStrGridModel(PWGM_HGRIDMODEL model)
Constructor.
The structured grid model class.
PWP_BOOL PwXform2to3(const PWGM_INDEX_XFORM2 *pX2, PWGM_INDEX_XFORM *pX3)
Convert a 2D transform matrix to it&#39;s 3D equivalent.
static bool inRange(const PWGM_INDEX3 &ijk, const PWGM_STR_RANGE &range)
Determines if an ijk index is within a given min/max range.
PWGM_ENUM_IJK PwXformFollows(const PWGM_INDEX_XFORM *pX3, PWGM_ENUM_IJK localAxis, PWP_BOOL *pFlipped)
For a given localAxis, determine the corresponding axis in the transformed system.
PWGM_ENUM_IJK PwXform2Follows(const PWGM_INDEX_XFORM2 *pX2, PWGM_ENUM_IJK localAxis, PWP_BOOL *pFlipped)
For a given localAxis, determine the corresponding axis in the transformed system.
PWGM_INDEX3 PwXformApply(const PWGM_INDEX_XFORM *pX3, PWGM_INDEX3 ijk)
Apply a PWGM_INDEX_XFORM transform to a PWGM_INDEX3 value.
An opaque handle to a grid model.
Definition: apiGridModel.h:326
bool operator>(const PWGM_HBLOCK &h1, const PWGM_HBLOCK &h2)
bool operator<(const PWGM_HBLOCK &h1, const PWGM_HBLOCK &h2)
static PWGM_INDEX3 ndxMapperCB(const PWGM_INDEX3 pwgmNdx, void *data)
static PWGM_ENUM_IJK xformFollows(const PWGM_INDEX_XFORM &x3, PWGM_ENUM_IJK localAxis, bool *pFlipped=0)
Determines which axes are parallel in a transformed ijk system.
The structured grid model index mapper handler class.