VTK
dox/Common/vtkQuadratureSchemeDefinition.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkQuadratureSchemeDefinition.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00034 #ifndef vtkQuadratureSchemeDefinition_h
00035 #define vtkQuadratureSchemeDefinition_h
00036 
00037 #include "vtkObject.h"
00038 
00039 class vtkInformationQuadratureSchemeDefinitionVectorKey;
00040 class vtkInformationStringKey;
00041 class vtkXMLDataElement;
00042 
00043 class VTK_COMMON_EXPORT vtkQuadratureSchemeDefinition : public vtkObject
00044 {
00045 public:
00046   // vtk stuff
00047   vtkTypeMacro(vtkQuadratureSchemeDefinition,vtkObject);
00048   void PrintSelf(ostream& os, vtkIndent indent);
00049   static vtkInformationQuadratureSchemeDefinitionVectorKey* DICTIONARY();
00050   static vtkInformationStringKey* QUADRATURE_OFFSET_ARRAY_NAME();
00051 
00054   static vtkQuadratureSchemeDefinition *New();
00055 
00057   int DeepCopy(const vtkQuadratureSchemeDefinition *other);
00058 
00060 
00062   int SaveState(vtkXMLDataElement *e);
00063   // Description:
00064   // Restore the object from an XML representation.
00065   int RestoreState(vtkXMLDataElement *e);
00067 
00070   void Clear();
00071 
00073 
00074   void Initialize(int cellType,
00075                   int numberOfNodes,
00076                   int numberOfQuadraturePoints,
00077                   double *shapeFunctionWeights);
00078   // Description:
00079   // Initialize the object allocating resources as needed.
00080   void Initialize(int cellType,
00081                   int numberOfNodes,
00082                   int numberOfQuadraturePoints,
00083                   double *shapeFunctionWeights,
00084                   double *quadratureWeights);
00086 
00088 
00089   int GetCellType() const { return this->CellType; }
00090   // Description:
00091   // Access to an alternative key.
00092   int GetQuadratureKey() const { return this->QuadratureKey; }
00093   // Description:
00094   // Get the number of nodes associated with the interpolation.
00095   int GetNumberOfNodes() const { return this->NumberOfNodes; }
00096   // Description:
00097   // Get the number of quadrature points associated with the scheme.
00098   int GetNumberOfQuadraturePoints() const { return this->NumberOfQuadraturePoints; }
00099   // Description:
00100   // Get the array of shape function weights. Shape function weights are
00101   // the shape functions evaluated at the quadrature points. There are 
00102   // "NumberOfNodes" weights for each quadrature point.
00103   const double *GetShapeFunctionWeights() const  { return this->ShapeFunctionWeights; }
00104   // Description:
00105   // Get the array of shape function weights associated with a
00106   // single quadrature point.
00107   const double *GetShapeFunctionWeights(int quadraturePointId) const
00108   {
00109     int idx=quadraturePointId*this->NumberOfNodes;
00110     return this->ShapeFunctionWeights+idx;
00111   }
00112   // Description:
00113   // Access to teh quadrature weights.
00114   const double *GetQuadratureWeights() const { return this->QuadratureWeights; }
00116 
00117 protected:
00118   vtkQuadratureSchemeDefinition();
00119   ~vtkQuadratureSchemeDefinition();
00120 private:
00122 
00124   void ReleaseResources();
00125   // Description:
00126   // Allocate resources according to the objects
00127   // current internal state.
00128   int SecureResources();
00129   // Description:
00130   // Initialize the shape function weights definition.
00131   // Must call SecureResources prior.
00132   void SetShapeFunctionWeights(const double *W);
00133   // Description:
00134   // Initialize the shape function weights definition.
00135   // Must call SecureResources prior.
00136   void SetQuadratureWeights(const double *W);
00138 
00139   //
00140   vtkQuadratureSchemeDefinition(const vtkQuadratureSchemeDefinition &); // Not implemented.
00141   void operator=(const vtkQuadratureSchemeDefinition &); // Not implemented.
00142   friend ostream &operator<<(ostream &s, const vtkQuadratureSchemeDefinition &d);
00143   friend istream &operator>>(istream &s, const vtkQuadratureSchemeDefinition &d);
00144   //
00145   int CellType;
00146   int QuadratureKey;
00147   int NumberOfNodes;
00148   int NumberOfQuadraturePoints;
00149   double *ShapeFunctionWeights;
00150   double *QuadratureWeights;
00151 };
00152 
00153 #endif
00154