Pointwise Plugin SDK
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cuns/runtimeWrite.cxx
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * CaeXxxxx implementation of runtimeWrite(), runtimeCreate(), and
4  * runtimeDestroy()
5  *
6  * (C) 2021 Cadence Design Systems, Inc. All rights reserved worldwide.
7  *
8  ***************************************************************************/
9 
10 #include "apiCAEP.h"
11 #include "apiCAEPUtils.h"
12 #include "apiGridModel.h"
13 #include "apiPWP.h"
14 #include "runtimeWrite.h"
15 #include "pwpPlatform.h"
16 
17 
18 #if 0
19 static void
20 stepN(CAEP_RTITEM *pRti)
21 {
22  PWP_UINT32 cnt = 1; /* the # of MINOR progress sub-steps */
23  if (caeuProgressBeginStep(pRti, cnt)) {
24  while (cnt--) {
25  /*
26  // PUT YOUR SUB-STEP OUTPUT LOGIC HERE
27  */
28  /* incr to next sub-step */
29  caeuProgressIncr(pRti);
30  }
31  caeuProgressEndStep(pRti);
32  }
33 }
34 #endif
35 
36 
37 //-------------------------------------------------------------------------
38 // The Mapper class is only needed if
39 // caeuPublishMeshLinkValueDefinitions("Custom") is called.
40 // See runtimeCreate() and PwModCustomIndexSchemeReady()
41 //-------------------------------------------------------------------------
42 
43 // This is a trivial, single offset example. Your data will most likely involve
44 // some sort of mapping container like std::map or std::unordered_map.
45 //struct Mapper {
46 // int offset; // fixed index offset
47 //
48 // static PWP_UINT64 cb(const PWP_UINT64 pwgmNdx, void *cbData)
49 // {
50 // // Given: pwgmNdx is the index to the vertex returned by
51 // // PwModEnumVertices(m, pwgmNdx). The caller wants pwgmNdx mapped to the
52 // // index of the vertex as written to the exported mesh file. Currently,
53 // // only indices that are part of DB constrained boundary patches get
54 // // mapped (subject to change). The mesh link export process invokes this
55 // // callback as needed.
56 //
57 // // cbData is the void* passed to PwModCustomIndexSchemeReady(cbData).
58 // Mapper *mapper = static_cast<Mapper*>(cbData);
59 //
60 // // Do something here to map the pwgmNdx (0..N-1) to the index used in
61 // // the exported mesh. In this trivial example, apply a fixed offset.
62 // PWP_UINT64 newNdx = pwgmNdx + mapper->offset;
63 //
64 // return newNdx;
65 // }
66 //};
67 
68 
71 {
72  // The PWGM_HGRIDMODEL and CAEP_WRITEINFO function arguments are deprecated.
73  // The use of pRti->model and pRti->pWriteInfo is now preferred.
74  // The grid model data is accessed via pRti->model.
75  // The user or Glyph specified export options are available directly via
76  // pRti->pWriteInfo or using one of the CAEPU_RT_XXXX(pRti) macros.
77 
78  PWP_BOOL ret = PWP_FALSE;
79  PWP_UINT32 cnt = 1; // the # of MAJOR progress steps
80  if (caeuProgressInit(pRti, cnt)) {
81  // PUT YOUR MAJOR-STEP OUTPUT LOGIC HERE
82  //step1(pRti);
83  //step2(pRti);
84  //...
85  //stepN(pRti);
86  caeuProgressEnd(pRti, ret);
87  ret = !pRti->opAborted;
88  }
89 
90  //-------------------------------------------------------------------------
91  // Only needed if caeuPublishMeshLinkValueDefinitions("Custom") is called.
92  // See runtimeCreate()
93  //-------------------------------------------------------------------------
94  // Capture data needed by Mapper::cb here. If no data needed, you can pass
95  // nullptr below instead of &mapper.
96  //Mapper mapper{ 10000 };
97  //ret = ret && PwModCustomIndexSchemeReady(pRti->model, Mapper::cb, &mapper);
98 
99  return ret;
100 }
101 
102 
103 PWP_BOOL
105 {
106  PWP_BOOL ret = PWP_TRUE;
107 
108  //-----------------------------------------------------------------------
109  // BYTE ORDERING:
110  // Uncomment the appropriate lines below to control the byte ordering
111  // options supported by the solver. If "AllowedFileByteOrders" is not
112  // set, the plugin will use the platform's native byte ordering.
113  // Currently, Pointwise only runs on little endian, intel platforms. If
114  // the solver targeted by this plugin cannot import little endian files,
115  // you must force big endian export.
116  //-----------------------------------------------------------------------
117  //const char * orders = "BigEndian"; // force big endian export
118  //const char * orders = "LittleEndian"; // force little endian export
119  //const char * orders = "BigEndian|LittleEndian"; // support both
120  //ret = ret && caeuAssignInfoValue("AllowedFileByteOrders", orders, true);
121 
122  //-----------------------------------------------------------------------
123  // ELEMENT TOPOLOGY:
124  // Uncomment the lines below and edit the topos[] value to explicitly
125  // control the element topology options supported by the solver. If
126  // "AllowedElementTopologies" is not set, the allowed element topologies
127  // will be inferred from the supported element types.
128  //-----------------------------------------------------------------------
129  //const char topos[] = "Structured|Unstructured|Prismatic";
130  //ret = ret && caeuAssignInfoValue("AllowedElementTopologies", topos, true);
131 
132  //-----------------------------------------------------------------------
133  // MESHLINK SUPPORT:
134  // Uncomment the appropriate line below if this plugin supports mesh link
135  // exporting for the given indexing scheme.
136  //
137  // ZeroBased -
138  // Vertices are written to the mesh file in the same order as returned
139  // by PwModEnumVertices(). In the mesh file the vertices are indexed as
140  // 0..NumVerts-1.
141  //
142  // OneBased -
143  // Vertices are written to the mesh file in the same order as returned
144  // by PwModEnumVertices(). In the mesh file the vertices are indexed as
145  // 1..NumVerts.
146  //
147  // Custom -
148  // Vertices are NOT written to the mesh file in the same order as
149  // returned by PwModEnumVertices(). In this case, the plugin must build
150  // an appropriate index map during export. After the mesh export is
151  // completed but before returning from runtimeWrite(), the plugin must
152  // call PwModCustomIndexSchemeReady(mapperCallback) to notify the
153  // Pointwise export framework that the vertex map is ready. Before
154  // returning from PwModCustomIndexSchemeReady(), the Pointwise export
155  // framework will invoke the mapperCallback as needed to map a PWGM
156  // index to its corresponding exported index.
157  // See PwModCustomIndexSchemeReady() for details.
158  //
159  // IMPORTANT:
160  // Pointwise only supports MeshLink generation for unstructured grids.
161  // This setting will be ignored for structured exports.
162  //-----------------------------------------------------------------------
163  //ret = ret && caeuPublishMeshLinkValueDefinitions("ZeroBased");
164  //ret = ret && caeuPublishMeshLinkValueDefinitions("OneBased");
165  //ret = ret && caeuPublishMeshLinkValueDefinitions("Custom");
166 
167 
168  //-----------------------------------------------------------------------
169  // NON-INFLATED BC TYPE NAMES:
170  // Uncomment the lines below and edit the shadowTypes[] value to
171  // specify which of the defined BCs types are non-inflated. Normally, if a
172  // BC is applied to a floating baffle domain, or block-to-block connection
173  // domain, the interior points are "inflated" to create a zero thickness
174  // wall. However, if a non-inflated BC is used, the points are NOT
175  // inflated. These BC types are often used for flow-through or porous
176  // conditions.
177  //-----------------------------------------------------------------------
178  //const char * const shadowTypes = "bcname1|bcname2";
179  //ret = ret && caeuassigninfovalue("ShadowBcTypes", shadowTypes, true);
180 
181  // These attributes are for example only. You can publish any attribute
182  // needed for your solver.
183  //ret = ret &&
184  // caeuPublishValueDefinition("iterations", PWP_VALTYPE_UINT, "5",
185  // "RW", "Number of iterations", "0 2000") &&
186  // caeuPublishValueDefinition("magnitude", PWP_VALTYPE_INT, "-5",
187  // "RW", "Signed int magnitude", "-100 100") &&
188  // caeuPublishValueDefinition("mach", PWP_VALTYPE_REAL, "0.3", "RW",
189  // "Incoming flow velocity", "-Inf +Inf 0.0 50.0") &&
190  // caeuPublishValueDefinition("temperature", PWP_VALTYPE_REAL, "77.5",
191  // "RW", "Ambient temperature", "-Inf +Inf -100.0 3000.0") &&
192  // caeuPublishValueDefinition("temperature.units", PWP_VALTYPE_ENUM,
193  // "Fahrenheit", "RW", "Grid temperature units", TempUnitEnum) &&
194  // caeuPublishValueDefinition("units", PWP_VALTYPE_ENUM, "Inches",
195  // "RW", "Grid dimensional units", DimUnitEnum) &&
196  // caeuPublishValueDefinition("description", PWP_VALTYPE_STRING, "",
197  // "RW", "Grid description", "") &&
198  // caeuPublishValueDefinition("linear", PWP_VALTYPE_BOOL, "reject",
199  // "RW", "Grid is linear", "reject|accept");
200 
201  return ret;
202 }
203 
204 
205 PWP_VOID
207 {
208 }
PWP_BOOL runtimeWrite(CAEP_RTITEM *pRti, PWGM_HGRIDMODEL model, const CAEP_WRITEINFO *pWriteInfo)
unsigned int PWP_UINT32
32-bit unsigned integer
Definition: apiPWP.h:210
Pointwise Plugin API (PWP-API)
void PWP_VOID
no value
Definition: apiPWP.h:317
Pointwise Grid Model API Specification (PWGM-API)
PWP_BOOL runtimeCreate(CAEP_RTITEM *pRti)
#define PWP_TRUE
PWP_BOOL logical &quot;true&quot; value.
Definition: apiPWP.h:309
PWP_BOOL caeuProgressIncr(CAEP_RTITEM *pRti)
Completes a progress tracking sub-step.
PWP_BOOL caeuProgressEndStep(CAEP_RTITEM *pRti)
Completes a progress tracking major step.
Cross Platform Functions.
PWP_BOOL caeuProgressBeginStep(CAEP_RTITEM *pRti, PWP_UINT32 total)
Begins a progress tracking step.
CAEP utilities.
PWP_BOOL caeuProgressInit(CAEP_RTITEM *pRti, PWP_UINT32 cnt)
Initializes a progress tracking session.
int PWP_BOOL
logical value
Definition: apiPWP.h:303
CAE export write control information.
Definition: apiCAEP.h:184
Pointwise CAE Plugin API (CAEP-API)
PWP_VOID runtimeDestroy(CAEP_RTITEM *pRti)
The data representing a CAE exporter instance.
Definition: apiCAEPUtils.h:124
void caeuProgressEnd(CAEP_RTITEM *pRti, PWP_BOOL ok)
Ends all progress tracking.
An opaque handle to a grid model.
Definition: apiGridModel.h:326
#define PWP_FALSE
PWP_BOOL logical &quot;false&quot; value.
Definition: apiPWP.h:306