Overture  Version 25
GraphicsParameters.h
Go to the documentation of this file.
1 #ifndef GRAPHICS_PARAMETERS_H
2 #define GRAPHICS_PARAMETERS_H
3 
4 #ifndef NO_APP
5 #include "GenericDataBase.h"
6 #endif
7 #include "GUITypes.h"
8 
9 #define KK_DEBUG
10 #include "DBase.hh"
11 using namespace DBase;
12 
13 //#include "aString.H"
14 #ifndef NO_APP
15 #include "aString.H"
16 #else
17 #include <string>
18 #ifndef aString
19 #define aString std::string
20 #endif
21 #endif
22 
23 class GenericGraphicsInterface; // forward declaration
24 class GL_GraphicsInterface; // forward declaration
25 class MappingInformation; // forward declaration
26 class GraphicsParameters;
27 
28 extern int
29 viewMappings( MappingInformation & mapInfo );
30 extern int
31 plotAListOfMappings(MappingInformation & mapInfo, // get rid of this eventually
32  const int & mapNumberToPlot,
33  int & numberOfMapsPlotted,
34  IntegerArray & listOfMapsToPlot,
35  aString *localColourNames,
36  const int & numberOfColourNames,
37  const bool & plotTheAxes,
38  GraphicsParameters & params );
39 extern int
40 readMappings( MappingInformation & mapInfo ); // get rid of this eventually
41 
42 // Here is the form of a user defined colour table
44 // /Description: Convert a value from [0,1] into (red,green,blue) values, each in the range [0,1]
45 // /value (input) : 0 <= value <= 1
46 // /red, green, blue (output) : values in the range [0,1]
47 
48 // NOTE: remember to change the documentation in GraphicsDoc.tex when you change this next table
50 {
162 };
163 
165 {
166 public:
167 
169 {
176  numberOfColourTables
177 } colourTable;
178 
180 {
181  postScript, // post script file with drawing commands
183  postScriptRaster, // post script containing a bit map image of the screen
184  ppm // portable pixmap format (P6 binary format)
185 };
186 
187 
188 enum OutputFormat // formats for outputing postscript files
189 {
190  colour8Bit, // compressed colour file with 225 colours
191  colour24Bit, // 24 bits of colour (2^24 colours)
192  blackAndWhite, // black and white
193  grayScale // 8 bit gray scale (2^8 shades of gray)
194 };
195 
196 enum Sizes // **** remember to change the version of this list in GenericGraphicsInterface
197 {
198  lineWidth, // basic width in pixels for a line
199  axisNumberSize, // size of number labels on the axes
200  axisLabelSize, // size of axis label ("x-axis")
207  minorContourWidth, // this times lineWidth = actual width in pixels for minor contour lines
208  majorContourWidth, // this times lineWidth = actual width in pixels for major contour lines
209  streamLineWidth, // this times lineWidth = actual width in pixels for stream lines
210  labelLineWidth, // this times lineWidth = actual width in pixels for lines that make up a character
211  curveLineWidth, // this times lineWidth = actual width in pixels for curves drawn
215  numberOfSizes // counts number of entries in this list
216 };
217 
218 enum GridOptions // bit-map values for grid plotting options: gridOption(grid)
219 {
220  plotGrid=1,
221  plotInterpolation = plotGrid << 1,
222  plotShadedSurfaces = plotInterpolation << 1,
223  plotInteriorGridLines = plotShadedSurfaces << 1,
224  plotBoundaryGridLines = plotInteriorGridLines << 1,
225  plotBlockBoundaries = plotBoundaryGridLines << 1,
226  plotBackupInterpolation = plotBlockBoundaries << 1,
227  plotInteriorBoundary = plotBackupInterpolation << 1,
228  doNotPlotFace00 = plotInteriorBoundary << 1,
229  doNotPlotFace10 = doNotPlotFace00 << 1,
230  doNotPlotFace01 = doNotPlotFace10 << 1,
231  doNotPlotFace11 = doNotPlotFace01 << 1,
232  doNotPlotFace02 = doNotPlotFace11 << 1,
233  doNotPlotFace12 = doNotPlotFace02 << 1,
234  doNotPlotGridLinesOnFace00 = doNotPlotFace12 << 1,
235  doNotPlotGridLinesOnFace10 = doNotPlotGridLinesOnFace00 << 1,
236  doNotPlotGridLinesOnFace01 = doNotPlotGridLinesOnFace10 << 1,
237  doNotPlotGridLinesOnFace11 = doNotPlotGridLinesOnFace01 << 1,
238  doNotPlotGridLinesOnFace02 = doNotPlotGridLinesOnFace11 << 1,
239  doNotPlotGridLinesOnFace12 = doNotPlotGridLinesOnFace02 << 1
240 };
241 
242 enum ColourOptions // options for colouring boundaries, grids lines and block boundaries
243 {
244  defaultColour, // default
252  colourByDomain
253 };
254 
255 // Here are the options for setting the colour bar min/max when plotting 3d contour/coordinate planes
257 {
259  baseMinMaxOnContourPlaneValues
260 };
261 
262 
263 GraphicsParameters(bool default0=FALSE);
264 
266 
267 bool
268 isDefault();
269 
270 // use these functions to determine current values for parameters
271 aString &
272 get(const GraphicsOptions & option, aString & label) const;
273 int &
274 get(const GraphicsOptions & option, int & value) const;
276 get(const GraphicsOptions & option, GUITypes::real & value) const;
277 IntegerArray &
278 get(const GraphicsOptions & option, IntegerArray & values) const;
279 RealArray &
280 get(const GraphicsOptions & option, RealArray & values) const;
282 get(const Sizes & option, GUITypes::real & value) const;
283 
284 // use these set functions to set a value for a GraphicsOptions parameter
285 int
286 set(const GraphicsOptions & option, const aString & label);
287 // int
288 // set(const GraphicsOptions & option, int value);
289 int
290 set(const GraphicsOptions & option, GUITypes::real value);
291 int
292 set(const GraphicsOptions & option, const IntegerArray & values);
293 int
294 set(const GraphicsOptions & option, const RealArray & values);
295 int
296 set(const Sizes & option, GUITypes::real value); // set a size
297 
298 int
299 setColourTable(ColourTableFunctionPointer ctf); // provide a function to use for a colour table
300 
301 int
302 setMinAndMaxContourLevels( const real minValue, const real maxValue, const int component=0 );
303 
304 //access routines
305 int
306 getObjectWasPlotted() const; // true if an object was plotted
307 
308 friend
310 friend
313 // AP testing
314 friend
315 class PlotIt;
316 
317 friend int
318 viewMappings( MappingInformation & mapInfo );
319 friend int
320 plotAListOfMappings(MappingInformation & mapInfo, // get rid of this eventually
321  const int & mapNumberToPlot,
322  int & numberOfMapsPlotted,
323  IntegerArray & listOfMapsToPlot,
324  aString *localColourNames,
325  const int & numberOfColourNames,
326  const bool & plotTheAxes,
327  GraphicsParameters & params );
328 friend int
329 readMappings( MappingInformation & mapInfo ); // get rid of this eventually
330 
331 // some access functions
332 bool &
333 getLabelGridsAndBoundaries(){ return labelGridsAndBoundaries; }
334 int &
335 getBoundaryColourOption(){ return boundaryColourOption; }
336 bool &
337 getPlotShadedSurface(){ return plotShadedSurface; }
338 bool &
339 getPlotLinesOnMappingBoundaries(){ return plotLinesOnMappingBoundaries; }
340 bool &
341 getPlotNonPhysicalBoundaries(){ return plotNonPhysicalBoundaries; }
342 bool &
343 getPlotGridPointsOnCurves(){ return plotGridPointsOnCurves; }
344 int &
345 getNumberOfGhostLinesToPlot(){ return numberOfGhostLinesToPlot; }
346 aString &
347 getMappingColour(){ return mappingColour; }
348 
349 
351 // protected: // should be protected but GL_GraphicsInterface needs these
353 enum ToggledItems // label bit flags used by gridsToPlot
354 {
355  toggleGrids=1,
356  toggleContours=2,
357  toggleStreamLines=4,
358  toggleSum=1+2+4
359 };
361 // parameters used generally:
362 aString topLabel,topLabel1,topLabel2,topLabel3;
363 aString bottomLabel,bottomLabel1,bottomLabel2,bottomLabel3;
364 bool plotObject; // immediately plot the object
365 bool plotObjectAndExit; // immediately plot the object then exit
366 bool usePlotBounds; // use plot bounds found in the plotBound array
367 bool usePlotBoundsOrLarger; // plot bounds should include bounds from plotBound array
368 bool plotTheAxes;
369 RealArray plotBound; // plotting bounds: plotBound(2,3)
370 RealArray size; // holds sizes for items in the Sizes enum
371 int objectWasPlotted; // true on exit if object was plotted (and not erased)
372 int numberOfGhostLinesToPlot;
373 bool plotBoundsChanged; // true if the plot bounds were changed
374 GUITypes::real relativeChangeForPlotBounds; // use with usePlotBoundsOrLarger
375 int multigridLevelToPlot;
376 int refinementLevelToPlot;
377 bool plotRefinementGrids;
378 bool keepAspectRatio; // default true. Keep the aspect ratio.
379 bool computeCoarseningFactor;
381 HardCopyType hardCopyType;
382 OutputFormat outputFormat;
383 int rasterResolution; // resolution for off screen renderer
384 
385 bool plotTitleLabels; // plot the top title etc. AP: NEEDS ACCESS FUNCTION!!!
386 bool labelColourBar;
387 int labelMinMax; // o=no-label, 1=set-label, 2=add-to-label
388 bool labelComponent; // include the component name on the top label (e.g. for contour)
390 // parameters used to plot Mappings
391 aString mappingColour;
392 bool plotGridPointsOnCurves;
393 bool plotEndPointsOnCurves;
394 bool plotLinesOnMappingBoundaries;
395 bool plotNonPhysicalBoundaries;
396 bool plotShadedMappingBoundaries;
397 bool plotMappingEdges;
398 bool plotMappingNormals;
399 bool plotNurbsCurvesAsSubCurves;
400 
401 GUITypes::real lineOffset, pointOffset, surfaceOffset; // shift (lines/points/polygons) this many "units" before plotting
403 // parameters for plotting grids
404 IntegerArray gridsToPlot; // bit flag: 1=plot grid, 2=plot contours, 4=plot streamlines.
405 IntegerArray gridOptions; // bit flag holding various options
406 IntegerArray gridBoundaryConditionOptions; // another bit flag
407 IntegerArray gridColours; // colours of grids (index into xColours array)
409 bool colourInterpolationPoints;
410 bool plotInterpolationPoints;
411 bool plotInterpolationCells;
412 bool plotBackupInterpolationPoints;
413 bool plotBranchCuts;
414 bool plotLinesOnGridBoundaries;
415 int plotGridLines; // bit 1 for 2d, bit 2 for 3d
416 bool plotGridBlockBoundaries;
417 bool plotShadedSurfaceGrids;
418 bool plotUnsNodes, plotUnsFaces, plotUnsEdges, plotUnsBoundaryEdges;
419 bool labelBoundaries;
420 bool plotInteriorBoundaryPoints;
421 bool plotHiddenRefinementPoints;
423 int boundaryColourOption; // 0=default, 1=by grid, 2=by refinement level, 3=BC, 4=by share
424 int gridLineColourOption; // 0=default, 1=by grid, 2=by refinement level
425 int blockBoundaryColourOption; // 0=default, 1=by grid, 2=by refinement level, 3=BC, 4=by share
426 
427 int boundaryColourValue;
428 int gridLineColourValue;
429 int blockBoundaryColourValue;
430 
431 // bool colourBoundariesByBoundaryConditions;
432 // bool colourGridByRefinementLevel;
433 // bool colourBoundariesByShare;
434 // bool colourBlockBoundaries;
435 GUITypes::real yLevelFor1DGrids; // for 1d grid plots.
436 GUITypes::real zLevelFor2DGrids;
437 bool labelGridsAndBoundaries;
438 
439 static GUITypes::real xScaleFactor, yScaleFactor, zScaleFactor; // for scaling plots
441 // These are for the contour plotter:
442 bool plotContourLines;
443 bool plotShadedSurface;
444 int numberOfContourLevels;
445 bool plotWireFrame;
446 bool colourLineContours;
447 bool plotColourBar;
448 int componentForContours;
449 int componentForSurfaceContours; // component for 3D contours on grid boundaries
450 IntegerArray componentsToPlot; // for 1d contour plots, multiple components
451 IntegerArray minAndMaxContourLevelsSpecified;
452 RealArray minAndMaxContourLevels; // for user specified min and max contour levels
453 RealArray contourLevels;
454 RealArray axesOrigin; // AP: Can this be removed ?
455 GUITypes::real minimumContourSpacing;
456 bool plotDashedLinesForNegativeContours;
457 bool plotGridBoundariesOnContourPlots;
458 GUITypes::real contourSurfaceVerticalScaleFactor;
459 GUITypes::real contourSurfaceSpatialBound; // by default use bounds from the grid
460 bool flatShading;
461 
462 bool linePlots; // plot solution on lines that intersect the range
463 int numberOfLines;
464 int numberOfPointsPerLine;
465 int numberOfContourPlanes;
466 RealArray linePlotEndPoints;
467 RealArray contourPlane; // contourPlane(0:5,number) 0:2 = normal, 3:5 = point on plane
468 IntegerArray plotContourOnGridFace;
470 IntegerArray coordinatePlane;
471 IntegerArray gridCoordinatePlane;
472 bool plot2DContoursOnCoordinatePlanes;
473 int normalAxisFor2DContoursOnCoordinatePlanes;
474 int numberOfIsoSurfaces;
475 int numberOfCoordinatePlanes;
476 int numberOfGridCoordinatePlanes;
477 int contour3dMinMaxOption;
479 // These are for streamlines
480 IntegerArray backGroundGridDimension; // number of points on back ground grid backGroundGridDimension(3)
481 int uComponentForStreamLines;
482 int vComponentForStreamLines;
483 int wComponentForStreamLines;
484 GUITypes::real minStreamLine, maxStreamLine; // determines how colours appear
485 GUITypes::real streamLineStoppingTolerance; // stop drawing when velocity decreases by this much
486 bool minAndMaxStreamLinesSpecified;
487 GUITypes::real streamLineArrowSize;
488 
489 // for 3d stream lines
490 int numberOfStreamLineStartingPoints;
491 realArray streamLineStartingPoint;
492 IntegerArray numberOfRakePoints;
493 realArray rakeEndPoint;
494 IntegerArray numberOfRectanglePoints;
495 realArray rectanglePoint;
497 // for plotting points:
499 int pointSymbol;
500 aString pointColour, lineColour;
502 // for unstructured mappings
503 bool useUnsCutplane, useUnsFlatShading;
504 RealArray unsCutplaneVertex;
505 RealArray unsCutplaneNormal;
507 // for plotting the displacement
508 int adjustGridForDisplacement; // plot contours etc. with grid + displacement instead of the grid
509 GUITypes::real displacementScaleFactor;
510 int displacementComponent[3]; // (u,v,w) component of the displacement are at these component indicies.
512 bool defaultObject;
513 
514 ColourTableFunctionPointer colourTableFunction;
516 public:
517 // Add these for userDefinedOutput functions that are called from contour functions for e.g.
518 void *showFileReader; // pointer to an active ShowFileReader (if any)
519 int showFileSolutionNumber; // current solution number in the show file.
520 void *showFileParameters; // pointer to an active ListOfShowFileParameters (if any)
521 
522 // Here is the new place to store parameters
523 DataBase dbase;
524 
525 };
526 
527 #endif