|
Intrepid
|
00001 // @HEADER 00002 // ************************************************************************ 00003 // 00004 // Intrepid Package 00005 // Copyright (2007) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Pavel Bochev (pbboche@sandia.gov) or 00025 // Denis Ridzal (dridzal@sandia.gov). 00026 // 00027 // ************************************************************************ 00028 // @HEADER 00029 00035 namespace Intrepid { 00036 00037 template <class Scalar, class ArrayPoint, class ArrayWeight> 00038 void CubatureDirect<Scalar,ArrayPoint,ArrayWeight>::getCubatureData(ArrayPoint & cubPoints, 00039 ArrayWeight & cubWeights, 00040 const CubatureTemplate * cubData) const { 00041 00042 int numCubPoints = getNumPoints(); 00043 int cellDim = getDimension(); 00044 // check size of cubPoints and cubWeights 00045 TEST_FOR_EXCEPTION( ( ( (int)cubPoints.size() < numCubPoints*cellDim ) || ( (int)cubWeights.size() < numCubPoints ) ), 00046 std::out_of_range, 00047 ">>> ERROR (CubatureDirect): Insufficient space allocated for cubature points or weights."); 00048 00049 for (int pointId = 0; pointId < numCubPoints; pointId++) { 00050 for (int dim = 0; dim < cellDim; dim++) { 00051 cubPoints(pointId,dim) = cubData->points_[pointId][dim]; 00052 } 00053 cubWeights(pointId) = cubData->weights_[pointId]; 00054 } 00055 } // end getCubatureData 00056 00057 00058 00059 template <class Scalar, class ArrayPoint, class ArrayWeight> 00060 void CubatureDirect<Scalar,ArrayPoint,ArrayWeight>::getCubature(ArrayPoint & cubPoints, 00061 ArrayWeight & cubWeights) const { 00062 getCubatureData( cubPoints, cubWeights, &(exposeCubatureData()[degree_]) ); 00063 } // end getCubature 00064 00065 00066 00067 template <class Scalar, class ArrayPoint, class ArrayWeight> 00068 int CubatureDirect<Scalar,ArrayPoint,ArrayWeight>::getNumPoints() const { 00069 return exposeCubatureData()[degree_].numPoints_; 00070 } // end getNumPoints 00071 00072 00073 00074 template <class Scalar, class ArrayPoint, class ArrayWeight> 00075 int CubatureDirect<Scalar,ArrayPoint,ArrayWeight>::getDimension() const { 00076 return dimension_; 00077 } // end dimension 00078 00079 00080 00081 template <class Scalar, class ArrayPoint, class ArrayWeight> 00082 void CubatureDirect<Scalar,ArrayPoint,ArrayWeight>::getAccuracy(std::vector<int> & accuracy) const { 00083 accuracy.assign(1, degree_); 00084 } // end getAccuracy 00085 00086 00087 } // end namespace Intrepid
1.7.4