Overture  Version 25
Integrate.h
Go to the documentation of this file.
1 #ifndef INTEGRATE_H
2 #define INTEGRATE_H "Integrate.h"
3 
4 // =======================================================================================
5 // Use this class to integrate functions on overlapping grids, both volume
6 // and surface integrals.
7 // =======================================================================================
8 
9 #include "Overture.h"
10 #include "BodyDefinition.h"
11 
12 class Oges;
13 class SurfaceStitcher;
14 
15 class Integrate
16 {
17  public:
18 
19  Integrate();
21  ~Integrate();
22 
23  int computeAllWeights();
24 
25  int defineSurface( const int & surfaceNumber, const int & numberOfFaces_, IntegerArray & boundary );
26 
27  // interactively define surface and compute weights
29 
30  // get from a database file:
31  int get( const GenericDataBase & dir, const aString & name);
32 
33  int getFace(const int surfaceNumber,const int face,
34  int & side, int & axis, int & grid) const;
35 
36  const BodyDefinition & getBodyDefinition() const;
37 
38  int numberOfFacesOnASurface(const int surfaceNumber) const;
39 
40  // return a pointer to the surface stitcher (if it exists)
42 
43  // put to a database file:
44  int put( GenericDataBase & dir, const aString & name) const;
45 
46  // Delete the solver used to compute the weights after the weights have been computed (to save space)
47  void setDeleteSolverAfterUse( bool trueOrFalse );
48 
49  // turn on interactive stitching (for debugging)
50  void setInteractiveStitching( bool trueOrFalse );
51 
52  void setRadialAxis( int axis );
53 
54  int setTolerance( const real tol );
55 
56  // Compute the surface.
57  real surfaceArea(const int & surfaceNumber = -1 );
58 
59  // Compute the surface integral
60  real surfaceIntegral(const RealCompositeGridFunction & u, const int & surfaceNumber = -1 );
61 
62  // Compute the surface integrals of some components
64  const Range & C,
65  RealArray & integral,
66  const int & surfaceNumber = -1 );
67 
68  int updateToMatchGrid( CompositeGrid & cg );
69 
70  // use AMR grids when computing integrals on grid functions that have AMR
71  void useAdaptiveMeshRefinementGrids(bool trueOrFalse = true );
72 
73  // use hybrid grids to compute integrals
74  void useHybridGrids( bool trueOrFalse = true );
75 
76  int updateForAMR(CompositeGrid &cg); // call this function when AMR grids have changed.
77 
78  // Compute the total volume:
79  real volume();
80 
81  // Compute the volume integral of a component of a grid function
82  real volumeIntegral( const RealCompositeGridFunction & u, const int component=0 );
83 
84  // Compute the volume integrals of specified components.
86  const Range & C,
87  RealArray & integral );
88 
91 
92 
93  static int debug;
94 
95  protected:
96 
97 
98  int initialize();
99  int computeWeights();
100  int computeSurfaceWeights(int surfaceNumber=-1 );
101 
102  int computeLeftNullVector();
103  int surfaceIndex( int surfaceNumber );
104 
105  // kkc 030225 added surface stitching using ugen for surface integrals
107 
108  int computeStitchedSurfaceWeights(int surfaceNumber=-1);
109 
111  const int & surfaceNumber = -1 );
113 
114 
115  aString className; // Name of the Class
116 
118  bool interactiveStitcher; // call the stitcher in an interactive mode (for debugging)
119  SurfaceStitcher *pSurfaceStitcher; // for stitching surfaces
120 
123 
127 
129 
131  real tolerance; // tolerance for sparse solver -- multiplied by the numberOfGridPoints
132 
135 
136  bool deleteSolverAfterUse; // delete the solver used to compute the weights after the weights have been computed
137 
138  // Weights for AMR grids
139  bool useAMR;
140  int *numberOfFacesPerSurface; // total number of faces for each surface, including AMR grids
147 
148  // axisymmetric stuff
150 
151  FILE *debugFile;
152 };
153 
154 #endif