Overture  Version 25
PlotIt.h
Go to the documentation of this file.
1 #ifndef PLOT_IT_H
2 #define PLOT_IT_H
3 
4 #include "OvertureTypes.h"
5 #include "GraphicsParameters.h"
6 
7 #ifdef OV_USE_DOUBLE
10 #else
13 #endif
14 
15 // forward declarations
16 class Mapping;
18 class TrimmedMapping;
19 class NurbsMapping;
20 class HyperbolicMapping;
21 class CompositeSurface;
22 class MappedGrid;
23 class AdvancingFront;
24 class GridCollection;
25 class ContourSurface;
26 class DialogData;
27 
28 class PlotIt
29 {
30 public:
31 
32 static int parallelPlottingOption; // 0=copy grid functions to proc. 0 for plotting, 1=plot distributed
33 
34 // Plot a Mapping, pass optional parameters
35 static void
38  int dList=0, bool lit=FALSE);
39 
40 // Plot a MappedGrid
41 static void
44 
45 // plot an advancing front
46 static void
49 
50 // Plot a GridCollection or Composite grid
51 static void
54 
55 // Plot quantities that show the quality of the mapping
56 static void
59 
60 // Plot quantities that show the quality of the grid
61 static void
64 
65 static void
67  GridCollection & gc,
69 
70 
71 // Plot 1D functions
72 static void
74  const realArray & t,
75  const realArray & x,
76  const aString & title = nullString,
77  const aString & tName = nullString,
78  const aString *xName = NULL,
80 
81 // Plot a time sequence of 1D functions to generate a surface
82 static void
84  const realArray & x,
85  const realArray & t,
86  const realArray & u,
88 
89 
90 // Show the parallel distribution of a grid.
91 static int
93 
94 // Plot contours and/or a shaded surface plot of a realMappedGridFunction in 2D or 3D
95 static void
98 
99 // Plot contours and/or a shaded surface plot of a GridCollectionFunction/CompositeGridFunction in 2D
100 static void
103 
104 static void
106  const realMappedGridFunction & uv,
108 
109 static void
111  const realGridCollectionFunction & uv0,
113 
114 // Plot the "displacement" for a solid mechanics problem, d = x + u, where x are the grid vertices
115 // and u is the provided solution.
116 static void
119 
120 // The next routine is called from contour. A user can write a new version of thei file in order
121 // to output values to a file in any given format.
122 static int
124  GraphicsParameters & par,
125  const aString & callingFunctionName);
126 
127 
128 // ------------ utility routines -------------
129 
130 static int
131 buildColourDialog(DialogData & dialog);
132 
133 static bool
134 getColour( const aString & answer_, DialogData & dialog, aString & colour );
135 
136 
137 static void
138 getGridBounds(const GridCollection & gc, GraphicsParameters & params, RealArray & xBound);
139 
140 
141 // ------------------------------------- protected -----------------------------------
142 protected:
143 
144 // Plot a GridCollection or Composite grid
145 static void
148  const realGridCollectionFunction *v = NULL );
149 
150 static void
153 
154 static void
157 
158 static void
160  const realGridCollectionFunction & uGCF,
161  GraphicsParameters & parameters,
162  real & uMin, real & uMax, real & uRaise,
163  bool & recomputeVelocityMinMax,
164  bool & contourLevelsSpecified,
165  RealArray & xBound );
166 
167 static void
170 
171 static void
174 
175 static void
177  const realGridCollectionFunction & uv,
178  GraphicsParameters & parameters);
179 
180 static void
182  const realGridCollectionFunction & uv,
183  GraphicsParameters & parameters);
184 
185 static void
187  const realGridCollectionFunction & uv,
188  IntegerArray & componentsToInterpolate,
189  IntegerArray & maskForStreamLines_,
190  real arrowSize,
191  GraphicsParameters & psp,
192  real & xa, real &ya, real & xb, real &yb, real &xba, real &yba,
193  real &uMin, real &uMax, int &nrsmx,
194  int & nxg, int & nyg, int & intopt );
195 
196 static void
198  const realGridCollectionFunction & uv,
199  int *componentsToInterpolate,
200  IntegerArray & maskForStreamLines,
201  real arrowSize,
202  GraphicsParameters & psp,
203  real *uip, int *indexGuessp,
204  real & xa, real &ya, real & xb, real &yb, real &xba, real &yba,
205  real &uMin, real &uMax, real &cfl, int &nrsmx,
206  int & nxg, int & nyg, real &xtp, real &ytp, int & intopt );
207 
208 
209 
210 static int
212  real *u,
213  real *x,
214  const int numberOfVerticies,
215  const real deltaU,
216  const real deltaUInverse,
217  const real uMin,
218  const real uMax,
219  const real uAverage,
220  const real uScaleFactor,
221  const real uRaise,
222  const RealArray & contourLevels,
223  bool & lineStipple,
224  bool contourLevelsSpecified,
225  GraphicsParameters & psp );
226 
227 static void
229  const MappedGrid & c,
230  const intSerialArray & mask,
231  const realSerialArray & vertex,
232  const Index & I1,
233  const Index & I2,
234  const Index & I3,
235  const int axis,
236  const int side,
237  GraphicsParameters & parameters );
238 
239 static void
241 
242 static void
244  real & uMin,
245  real & uMax,
246  GraphicsParameters & parameters,
247  const Range & R0=nullRange, // check these entries of component 0
248  const Range & R1=nullRange, // check these entries of component 1
249  const Range & R2=nullRange,
250  const Range & R3=nullRange,
251  const Range & R4=nullRange);
252 
253 static void
254 getPlotBounds(const GridCollection & gc, GraphicsParameters & params, RealArray & xBound);
255 
256 // Plot the boundaries of a 2D grid
257 static void
259  IntegerArray & boundaryConditionList, int numberOfBoundaryConditions,
260  const int colourOption=0,
261  const real zRaise=0., GraphicsParameters & parameters=Overture::defaultGraphicsParameters());
262 
263 static int
264 bcNumber( const int bc, IntegerArray & boundaryConditionList, int numberOfBoundaryConditions );
265 
266 static void
268  IntegerArray & boundaryConditionList,
269  int numberOfBoundaryConditions,
270  IntegerArray & numberList, int & number, int list, int litList);
271 
272 static void
274  GraphicsParameters & psp,
275  IntegerArray & boundaryConditionList,
276  int numberOfBoundaryConditions,
277  IntegerArray & numberList,
278  int & number, int list, int lightList);
279 
280 static int
282  int dList=0, bool lit=FALSE);
283 
284 static int
286  GraphicsParameters & par, const int plotOptions);
287 
288 // plot an unstructured mapping
289 static void
292  int dList=0, bool lit=FALSE);
293 
294 // plot a structured mapping
295 static void
298  int dList=0, bool lit=FALSE);
299 
300 // plot a CompositeSurface
301 static void
304 
305 static void
307 
308 static void
310 
311 // plot a trimmed mapping, uses glunurbs unless Mesa is configured
312 static void
315  int dList =0, bool lit =FALSE);
316 
317 // plot a nurbs mapping, uses glunurbs unless Mesa is configured
318 static void
321  int dList =0, bool lit =FALSE);
322 
323 // nurbs rendering calls using gl
324 static void
327 
328 static void
330 
331 static void
332 renderNurbsCurve(GenericGraphicsInterface &gi, NurbsMapping &map, float mode, int type);
333 
334 static void
336 
337 static void
339  const RealArray & x,
340  const Index & I1,
341  const Index & I2,
342  const Index & I3,
343  const int axis,
344  const int side,
345  const int domainDimension,
346  const int rangeDimension,
347  const RealArray & rgb,
348  const intArray & mask = Overture::nullIntegerDistributedArray() );
349 
350 static void
352  const RealArray & x,
353  const Index & I1,
354  const Index & I2,
355  const Index & I3,
356  const int axis,
357  const bool offsetLines,
358  const real eps,
359  GraphicsParameters & parameters,
360  const intArray & mask = Overture::nullIntegerDistributedArray() );
361 
362 static void
364  const Mapping & mapping,
365  const RealArray & vertex,
366  const int colourOption=1,
367  const real zRaise=0.,
369 
370 static void
372  const RealArray & x,
373  const IntegerArray & gridIndexRange,
374  GraphicsParameters & parameters,
375  const intArray & mask,
376  int grid =0 );
377 
378 
379 static void
381  GraphicsParameters & psp, RealArray & xBound,
382  int multigridLevelToPlot, IntegerArray & numberList, int & number );
383 
384 static void
386  const realGridCollectionFunction & uGCF,
387  GraphicsParameters & psp, int list, int lightList,
388  bool & plotContours,
389  bool & recomputeVelocityMinMax, real & uMin, real & uMax,
390  ContourSurface *&cs,
391  IntegerArray & numberOfPolygonsPerSurface,
392  IntegerArray & numberOfVerticesPerSurface );
393 
394 static void
396  const realGridCollectionFunction & uGCF,
397  GraphicsParameters & psp, int list, int lightList,
398  bool & plotContours,
399  bool & recomputeVelocityMinMax, real & uMin, real & uMax,
400  ContourSurface *&cs,
401  IntegerArray & numberOfPolygonsPerSurface,
402  IntegerArray & numberOfVerticesPerSurface );
403 
404 static aString
405 getGridColour( int item, int side, int axis,
406  int grid, const GridCollection & gc, GenericGraphicsInterface & gi, GraphicsParameters & par );
407 
408 
409 // adjust the grid to include the displacement
410 static int
412  realSerialArray *& xSave, real displacementScaleFactor );
413 
414 // un-adjust the grid to include the displacement
415 static int
417  realSerialArray *& xSave, real displacementScaleFactor );
418 
419 };
420 #endif