00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifndef SUNDANCEGAUSSLOBATTOQUADRATURE_HPP_
00051 #define SUNDANCEGAUSSLOBATTOQUADRATURE_HPP_
00052
00053 #include "SundanceDefs.hpp"
00054 #include "PlayaTabs.hpp"
00055 #include "SundanceQuadratureFamilyBase.hpp"
00056
00057 namespace Sundance {
00058
00059 class GaussLobattoQuadrature : public QuadratureFamilyBase {
00060
00061 public:
00062
00063
00064 GaussLobattoQuadrature(int order);
00065
00066
00067 virtual ~GaussLobattoQuadrature()
00068 {;}
00069
00070
00071 virtual XMLObject toXML() const;
00072
00073
00074 virtual std::string description() const
00075 {
00076 return "GaussLobattoQuadrature[order=" + Teuchos::toString(order()) + "]";
00077 }
00078
00079
00080 GET_RCP(QuadratureFamilyStub);
00081
00082 protected:
00083
00084 virtual void getLineRule(Array<Point>& quadPointsL,
00085 Array<double>& quadWeights) const;
00086
00087
00088 virtual void getTriangleRule(Array<Point>& quadPoints,
00089 Array<double>& quadWeights) const;
00090
00091
00092 virtual void getQuadRule(Array<Point>& quadPoints,
00093 Array<double>& quadWeights) const;
00094
00095
00096 virtual void getTetRule(Array<Point>& quadPoints,
00097 Array<double>& quadWeights) const ;
00098
00099
00100 virtual void getBrickRule(Array<Point>& quadPoints,
00101 Array<double>& quadWeights) const;
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 virtual void getAdaptedWeights(const CellType& cellType, int cellDim,
00117 int cellLID, int facetIndex, const Mesh& mesh,
00118 const ParametrizedCurve& globalCurve,
00119 Array<Point>& quadPoints, Array<double>& quadWeights,
00120 bool &weightsChanged) const;
00121
00122
00123 virtual void getAdaptedQuadWeights(int cellLID, const Mesh& mesh,
00124 const ParametrizedCurve& globalCurve, Array<Point>& quadPoints,
00125 Array<double>& quadWeights, bool& weightsChanged) const;
00126
00127
00128 virtual void getAdaptedQuadWeights_polygon(int cellLID, const Mesh& mesh,
00129 const ParametrizedCurve& globalCurve, Array<Point>& quadPoints,
00130 Array<double>& quadWeights, bool& weightsChanged) const;
00131
00132
00133 virtual void getAdaptedQuadWeights_surf(int cellLID, const Mesh& mesh,
00134 const ParametrizedCurve& globalCurve, Array<Point>& quadPoints,
00135 Array<double>& quadWeights, bool& weightsChanged) const;
00136
00137 private:
00138
00139
00140 void getTriangleQuadPoints(Array<Point>& pnt , Array<double>& weight ) const;
00141
00142
00143
00144
00145
00146 inline double evalLagrangePol(int i , Array<Point>& pnt , double x) const{
00147 int m = pnt.size();
00148 double p = 1.0;
00149 for (int j = 0 ; (j <= i-1)&&(j<m) ; j++){
00150 p = p *( x - pnt[j][0] )/(pnt[i][0] - pnt[j][0]);
00151 }
00152 for (int j = i+1 ; j < m ; j++){
00153 p = p *( x - pnt[j][0] )/(pnt[i][0] - pnt[j][0]);
00154 }
00155 return p;
00156 }
00157
00158
00159
00160 inline void makeInterpolantQuad( double px, double py, double ofx, double ofy,
00161 int nr1DPoints , int nr2DPoints ,
00162 Array<Point>& linePoints ,
00163 Array<Point>& quadPoints ,
00164 Array<double>& pointWeights ,
00165 Array<double>& weightsOut ,
00166 double areFakt ) const {
00167 int xi,yi;
00168 double xc,yc, intR , valTmp , valBasisX , valBasisY ;
00169
00170
00171
00172
00173
00174
00175 if ( fabs(ofx*ofy) < 1e-14 ) {
00176
00177 return;
00178 }
00179
00180 for (int i = 0 ; i < nr2DPoints ; i++){
00181
00182 yi = i % nr1DPoints; xi = i / nr1DPoints; intR = 0.0;
00183
00184 for (int q = 0 ; q < pointWeights.size() ; q++){
00185 xc = px + quadPoints[q][0]*ofx;
00186 yc = py + quadPoints[q][1]*ofy;
00187 valBasisX = evalLagrangePol(xi , linePoints , xc);
00188 valBasisY = evalLagrangePol(yi , linePoints , yc);
00189 valTmp = pointWeights[q] * ( valBasisX * valBasisY);
00190 intR = intR + valTmp;
00191
00192
00193
00194
00195 }
00196 intR = intR * ::fabs(ofx*ofy/areFakt);
00197 weightsOut[i] = weightsOut[i] + intR;
00198 }
00199 }
00200
00201
00202
00203
00204 inline void makeInterpolantBrick(int nr1DPoints , int nr3DPoints ,
00205 Array<Point>& linePoints ,
00206 Array<Point>& quadPoints ,
00207 Array<double>& pointWeights ,
00208 Array<double>& weightsOut ,
00209 double areFakt ) const {
00210 int xi,yi,zi;
00211 double xc,yc,zc, intR , valTmp , valBasisX , valBasisY , valBasisZ;
00212
00213 for (int i = 0 ; i < nr3DPoints ; i++){
00214 zi = i/(nr1DPoints*nr1DPoints); yi = (i%(nr1DPoints*nr1DPoints)) / nr1DPoints;
00215 xi = (i%(nr1DPoints*nr1DPoints)) % nr1DPoints; intR = 0.0;
00216
00217 for (int q = 0 ; q < pointWeights.size() ; q++){
00218 xc = quadPoints[q][0]; yc = quadPoints[q][1]; zc = quadPoints[q][2];
00219 valBasisX = evalLagrangePol(xi , linePoints , xc);
00220 valBasisY = evalLagrangePol(yi , linePoints , yc);
00221 valBasisZ = evalLagrangePol(zi , linePoints , zc);
00222 valTmp = pointWeights[q] * ( valBasisX * valBasisY * valBasisZ );
00223 intR = intR + valTmp;
00224
00225
00226
00227
00228 }
00229 intR = intR * areFakt ;
00230 weightsOut[i] = weightsOut[i] + intR;
00231 }
00232 }
00233
00234
00235
00236
00237 int nrPointin1D_;
00238
00239
00240 int verb_;
00241
00242 static const int quadsEdgesPoints[4][2];
00243
00244
00245 static const int edge3DProjection[12];
00246 };
00247
00248 }
00249
00250 #endif