Pointwise Plugin SDK
CaeStrGridModel.cxx
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * CaeStrGridModel class
4  *
5  * Proprietary software product of Pointwise, Inc.
6  * Copyright (c) 1995-2020 Pointwise, Inc.
7  * All rights reserved.
8  *
9  ***************************************************************************/
10 
11 #if !defined(PWGM_HIDE_STRUCTURED_API)
12 
13 #include "apiGridModel.h"
14 #include "apiPWP.h"
15 
16 #include "CaeGridModel.h"
17 #include "CaeStrGridModel.h"
18 
19 
20 //***************************************************************************
21 //***************************************************************************
22 //***************************************************************************
23 
25  CaeGridModel(model)
26 {
27 }
28 
30  CaeGridModel(src.model_)
31 {
32 }
33 
35 {
36 }
37 
38 
39 
40 static PWGM_INDEX3
41 ndxMapperCB(const PWGM_INDEX3 pwgmNdx, void *data)
42 {
44  return handler->mapIndex(pwgmNdx);
45 }
46 
47 bool
49 {
50  return 0 != PwModCustomIndex3SchemeReady(model_, ndxMapperCB, &handler);
51 }
52 
53 
54 bool
56 {
57  return 0 != PwXform2to3(&x2, &x3);
58 }
59 
60 bool
62 {
63  return 0 != PwXform3to2(&x3, &x2);
64 }
65 
68 {
69  return PwXformApply(&x3, ijk);
70 }
71 
74  localAxis, bool *pFlipped)
75 {
76  PWP_BOOL locFlipped;
77  PWGM_ENUM_IJK ret = PwXformFollows(&x3, localAxis, &locFlipped);
78  if (0 != pFlipped) {
79  *pFlipped = (0 != locFlipped);
80  }
81  return ret;
82 }
83 
86  ijk)
87 {
88  return PwXform2Apply(&x2, ijk);
89 }
90 
93  localAxis, bool *pFlipped)
94 {
95  PWP_BOOL locFlipped;
96  PWGM_ENUM_IJK ret = PwXform2Follows(&x2, localAxis, &locFlipped);
97  if (0 != pFlipped) {
98  *pFlipped = (0 != locFlipped);
99  }
100  return ret;
101 }
102 
103 bool
105 {
106  return 0 != PwInRange(ijk, &range);
107 }
108 
109 
110 // data layout for PWGM_HBNDRY:
111 // struct PWGM_HBNDRY {
112 // PWGM_HGRIDMODEL hP;
113 // PWP_UINT32 id;
114 // }
115 
116 bool
117 operator==(const PWGM_HBNDRY &h1, const PWGM_HBNDRY &h2)
118 {
119  // for speed, compare ids first. This assumes that most compares will
120  // differ in ids. Only if ids are the same will the remaining, more
121  // expensive compares be performed.
122  return (PWGM_HBNDRY_ID(h1) == PWGM_HBNDRY_ID(h2)) && // .id
123  (PWGM_HBNDRY_OUT_GMIMPL(h1) == PWGM_HBNDRY_OUT_GMIMPL(h2)); // .hP
124 }
125 
126 bool
127 operator!=(const PWGM_HBNDRY &h1, const PWGM_HBNDRY &h2)
128 {
129  return !(h1 == h2);
130 }
131 
132 bool
133 operator<(const PWGM_HBNDRY &h1, const PWGM_HBNDRY &h2)
134 {
135  // for speed, compare ids first. This assumes that most compares will
136  // differ in ids. Only if ids are the same will the remaining, more
137  // expensive compares be performed.
138  if (PWGM_HBNDRY_ID(h1) < PWGM_HBNDRY_ID(h2)) { // .id
139  return true;
140  }
141  else if (PWGM_HBNDRY_ID(h1) > PWGM_HBNDRY_ID(h2)) { // .id
142  return false;
143  }
144  else if (PWGM_HBNDRY_OUT_GMIMPL(h1) < PWGM_HBNDRY_OUT_GMIMPL(h2)) { // parent.hP
145  return true;
146  }
147  return false; // PWGM_HBNDRY_OUT_GMIMPL(h1) >= PWGM_HBNDRY_OUT_GMIMPL(h2)
148 }
149 
150 bool
151 operator>(const PWGM_HBNDRY &h1, const PWGM_HBNDRY &h2)
152 {
153  return (h1 != h2) && !(h1 < h2);
154 }
155 
156 
157 // data layout for PWGM_HCNXN:
158 // struct PWGM_HCNXN {
159 // PWGM_HGRIDMODEL hP;
160 // PWP_UINT32 id;
161 // }
162 
163 bool
164 operator==(const PWGM_HCNXN &h1, const PWGM_HCNXN &h2)
165 {
166  // for speed, compare ids first. This assumes that most compares will
167  // differ in ids. Only if ids are the same will the remaining, more
168  // expensive compares be performed.
169  return (PWGM_HCNXN_ID(h1) == PWGM_HCNXN_ID(h2)) && // .id
170  (PWGM_HCNXN_OUT_GMIMPL(h1) == PWGM_HCNXN_OUT_GMIMPL(h2)); // .hP
171 }
172 
173 bool
174 operator!=(const PWGM_HCNXN &h1, const PWGM_HCNXN &h2)
175 {
176  return !(h1 == h2);
177 }
178 
179 bool
180 operator<(const PWGM_HCNXN &h1, const PWGM_HCNXN &h2)
181 {
182  // for speed, compare ids first. This assumes that most compares will
183  // differ in ids. Only if ids are the same will the remaining, more
184  // expensive compares be performed.
185  if (PWGM_HCNXN_ID(h1) < PWGM_HCNXN_ID(h2)) { // .id
186  return true;
187  }
188  else if (PWGM_HCNXN_ID(h1) > PWGM_HCNXN_ID(h2)) { // .id
189  return false;
190  }
191  else if (PWGM_HCNXN_OUT_GMIMPL(h1) < PWGM_HCNXN_OUT_GMIMPL(h2)) { // parent.hP
192  return true;
193  }
194  return false; // PWGM_HCNXN_OUT_GMIMPL(h1) >= PWGM_HCNXN_OUT_GMIMPL(h2)
195 }
196 
197 bool
198 operator>(const PWGM_HCNXN &h1, const PWGM_HCNXN &h2)
199 {
200  return (h1 != h2) && !(h1 < h2);
201 }
202 
203 #endif // PWGM_HIDE_STRUCTURED_API
The 2D transform matrix data type.
Definition: apiGridModel.h:905
bool operator>(const PWGM_HBNDRY &h1, const PWGM_HBNDRY &h2)
The 3D transform matrix data type.
Definition: apiGridModel.h:894
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.
PWGM_HGRIDMODEL model_
The bound PWGM_HGRIDMODEL.
Definition: CaeGridModel.h:147
Pointwise Grid Model API Specification (PWGM-API)
#define PWGM_HBNDRY_ID(h)
gets the boundary&#39;s guid from the handle
Definition: apiGridModel.h:477
PWP_BOOL PwModCustomIndex3SchemeReady(PWGM_HGRIDMODEL model, PWGM_INDEX3MAPPERCB cb, void *data)
Notifys the Pointwise export framework that the custom index3 map is ready.
PWGM_ENUM_IJK
IJK component type ids.
Definition: apiGridModel.h:988
An opaque handle to a structured block boundary.
Definition: apiGridModel.h:459
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:484
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_HBNDRY &h1, const PWGM_HBNDRY &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:502
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:882
virtual PWGM_INDEX3 mapIndex(const PWGM_INDEX3 pwgmNdx)=0
Pure virtual index mapping method.
Structured grid ijk index data type.
Definition: apiGridModel.h:861
int PWP_BOOL
logical value
Definition: apiPWP.h:305
The grid model base class.
Definition: CaeGridModel.h:48
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.
bool operator<(const PWGM_HBNDRY &h1, const PWGM_HBNDRY &h2)
The structured grid model class.
bool operator==(const PWGM_HBNDRY &h1, const PWGM_HBNDRY &h2)
PWP_BOOL PwXform2to3(const PWGM_INDEX_XFORM2 *pX2, PWGM_INDEX_XFORM *pX3)
Convert a 2D transform matrix to it&#39;s 3D equivalent.
bool customIndexSchemeReady(CaeStrCustomIndexHandler &handler) const
Notify export framework that custom index mapper is ready for use.
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:328
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.