Chaste Release::3.1
GaussianQuadratureRule.cpp
00001 /*
00002 
00003 Copyright (c) 2005-2012, University of Oxford.
00004 All rights reserved.
00005 
00006 University of Oxford means the Chancellor, Masters and Scholars of the
00007 University of Oxford, having an administrative office at Wellington
00008 Square, Oxford OX1 2JD, UK.
00009 
00010 This file is part of Chaste.
00011 
00012 Redistribution and use in source and binary forms, with or without
00013 modification, are permitted provided that the following conditions are met:
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019  * Neither the name of the University of Oxford nor the names of its
00020    contributors may be used to endorse or promote products derived from this
00021    software without specific prior written permission.
00022 
00023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00026 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00027 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00028 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00029 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00030 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00032 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 
00034 */
00035 
00036 #include <cmath>
00037 
00038 #include "GaussianQuadratureRule.hpp"
00039 #include "Exception.hpp"
00040 #include "UblasCustomFunctions.hpp"
00041 
00042 template<unsigned ELEMENT_DIM>
00043 const ChastePoint<ELEMENT_DIM>& GaussianQuadratureRule<ELEMENT_DIM>::rGetQuadPoint(unsigned index) const
00044 {
00045     assert(index < mNumQuadPoints);
00046     return mPoints[index];
00047 }
00048 
00049 template<unsigned ELEMENT_DIM>
00050 double GaussianQuadratureRule<ELEMENT_DIM>::GetWeight(unsigned index) const
00051 {
00052     assert(index < mNumQuadPoints);
00053     return mWeights[index];
00054 }
00055 
00056 template<unsigned ELEMENT_DIM>
00057 unsigned GaussianQuadratureRule<ELEMENT_DIM>::GetNumQuadPoints() const
00058 {
00059     return mNumQuadPoints;
00060 }
00061 
00067 template<>
00068 GaussianQuadratureRule<0>::GaussianQuadratureRule(unsigned numPointsInEachDimension)
00069 {
00070     mNumQuadPoints = 1; // numPointsInEachDimension^0
00071     mWeights.reserve(mNumQuadPoints);
00072     mPoints.reserve(mNumQuadPoints);
00073     mWeights.push_back(1);
00074     mPoints.push_back(ChastePoint<0>());
00075 }
00076 
00082 template<>
00083 GaussianQuadratureRule<1>::GaussianQuadratureRule(unsigned numPointsInEachDimension)
00084 {
00085     mNumQuadPoints = numPointsInEachDimension;
00086 
00087     mWeights.reserve(mNumQuadPoints);
00088     mPoints.reserve(mNumQuadPoints);
00089     switch (numPointsInEachDimension)
00090     {
00091         case 1: // 1d, 1 point
00092             mWeights.push_back(1);
00093             mPoints.push_back(ChastePoint<1>(0.5));
00094             break;
00095         case 2: // 1d, 2 points
00096             mWeights.push_back(0.5);
00097             mWeights.push_back(0.5);
00098 
00099             mPoints.push_back(ChastePoint<1>(0.21132486540519));
00100             mPoints.push_back(ChastePoint<1>(0.78867513459481));
00101             break;
00102         case 3: // 1d, 3 points
00103             mWeights.push_back(5.0/18.0);
00104             mWeights.push_back(4.0/9.0);
00105             mWeights.push_back(5.0/18.0);
00106             mPoints.push_back(ChastePoint<1>(0.1127016654));
00107             mPoints.push_back(ChastePoint<1>(0.5));
00108             mPoints.push_back(ChastePoint<1>(0.8872983346));
00109             break;
00111 //        case 4: // 1d, 4 points
00112 //            mWeights.push_back(  0.17392732255);
00113 //            mWeights.push_back(  0.32607267745);
00114 //            mWeights.push_back(  0.32607267745);
00115 //            mWeights.push_back(  0.17392732255);
00116 //            mPoints.push_back(ChastePoint<1>(   0.0694318417));
00117 //            mPoints.push_back(ChastePoint<1>(   0.3300094782));
00118 //            mPoints.push_back(ChastePoint<1>(   0.6699905218));
00119 //            mPoints.push_back(ChastePoint<1>(   0.9305681583));
00120 //            break;
00121 //        case 5: // 1d, 5 points
00122 //            mWeights.push_back(   0.1184634425);
00123 //            mWeights.push_back(  0.23931433525);
00124 //            mWeights.push_back(  0.28444444445);
00125 //            mWeights.push_back(  0.23931433525);
00126 //            mWeights.push_back(   0.1184634425);
00127 //            mPoints.push_back(ChastePoint<1>(  0.04691007705));
00128 //            mPoints.push_back(ChastePoint<1>(  0.23076534495));
00129 //            mPoints.push_back(ChastePoint<1>(            0.5));
00130 //            mPoints.push_back(ChastePoint<1>(  0.76923465505));
00131 //            mPoints.push_back(ChastePoint<1>(  0.95308992295));
00132 //            break;
00133 //        case 8: // 1d, 8 points
00134 //            mWeights.push_back(  0.05061426815);
00135 //            mWeights.push_back(  0.11119051725);
00136 //            mWeights.push_back(  0.15685332295);
00137 //            mWeights.push_back(   0.1813418917);
00138 //            mWeights.push_back(   0.1813418917);
00139 //            mWeights.push_back(  0.15685332295);
00140 //            mWeights.push_back(  0.11119051725);
00141 //            mWeights.push_back(  0.05061426815);
00142 //            mPoints.push_back(ChastePoint<1>(  0.01985507175));
00143 //            mPoints.push_back(ChastePoint<1>(   0.1016667613));
00144 //            mPoints.push_back(ChastePoint<1>(  0.23723379505));
00145 //            mPoints.push_back(ChastePoint<1>(  0.40828267875));
00146 //            mPoints.push_back(ChastePoint<1>(  0.59171732125));
00147 //            mPoints.push_back(ChastePoint<1>(  0.76276620495));
00148 //            mPoints.push_back(ChastePoint<1>(   0.8983332387));
00149 //            mPoints.push_back(ChastePoint<1>(  0.98014492825));
00150 //            break;
00151          default:
00152             EXCEPTION("Number of gauss points per dimension not supported.");
00153     }
00154 }
00155 
00161 template<>
00162 GaussianQuadratureRule<2>::GaussianQuadratureRule(unsigned numPointsInEachDimension)
00163 {
00164     mNumQuadPoints = numPointsInEachDimension * numPointsInEachDimension;
00165 
00166     mWeights.reserve(mNumQuadPoints);
00167     mPoints.reserve(mNumQuadPoints);
00168 
00169     switch (numPointsInEachDimension)
00170     {
00171         case 1: // 2d, 1 point per dimension
00172             mWeights.push_back(0.5);
00173             mPoints.push_back(ChastePoint<2>(0.25,0.5));
00174             break;
00175 
00176         case 2: // 2d, 2 points per dimension
00177             mWeights.push_back(0.19716878364870);
00178             mWeights.push_back(0.19716878364870);
00179             mWeights.push_back(0.05283121635130);
00180             mWeights.push_back(0.05283121635130);
00181 
00182             mPoints.push_back(ChastePoint<2>(0.16666666666667,0.21132486540519));
00183             mPoints.push_back(ChastePoint<2>(0.62200846792815,0.21132486540519));
00184             mPoints.push_back(ChastePoint<2>(0.04465819873852,0.78867513459481));
00185             mPoints.push_back(ChastePoint<2>(0.16666666666667,0.78867513459481));
00186             break;
00187 
00188         case 3: // 2d, 3 points per dimension
00189             mWeights.push_back(0.06846437766975);
00190             mWeights.push_back(0.10954300427160);
00191             mWeights.push_back(0.06846437766975);
00192             mWeights.push_back(0.06172839506173);
00193             mWeights.push_back(0.09876543209877);
00194             mWeights.push_back(0.06172839506173);
00195             mWeights.push_back(0.00869611615741);
00196             mWeights.push_back(0.01391378585185);
00197             mWeights.push_back(0.00869611615741);
00198 
00199             mPoints.push_back(ChastePoint<2>(0.10000000001607,0.11270166540000));
00200             mPoints.push_back(ChastePoint<2>(0.44364916730000,0.11270166540000));
00201             mPoints.push_back(ChastePoint<2>(0.78729833458393,0.11270166540000));
00202             mPoints.push_back(ChastePoint<2>(0.05635083270000,0.50000000000000));
00203             mPoints.push_back(ChastePoint<2>(0.25000000000000,0.50000000000000));
00204             mPoints.push_back(ChastePoint<2>(0.44364916730000,0.50000000000000));
00205             mPoints.push_back(ChastePoint<2>(0.01270166538393,0.88729833460000));
00206             mPoints.push_back(ChastePoint<2>(0.05635083270000,0.88729833460000));
00207             mPoints.push_back(ChastePoint<2>(0.10000000001607,0.88729833460000));
00208             break;
00210 //        case 4: // 2d, 4 points per dimension
00211 //            mWeights.push_back(0.0281503507763256);
00212 //            mWeights.push_back(0.0527752633353762);
00213 //            mWeights.push_back(0.0527752633353762);
00214 //            mWeights.push_back(0.0281503507763256);
00215 //            mWeights.push_back(0.0379971374528828);
00216 //            mWeights.push_back(0.0712356642018415);
00217 //            mWeights.push_back(0.0712356642018415);
00218 //            mWeights.push_back(0.0379971374528828);
00219 //            mWeights.push_back(0.0187158102927055);
00220 //            mWeights.push_back(0.0350877267775703);
00221 //            mWeights.push_back(0.0350877267775703);
00222 //            mWeights.push_back(0.0187158102927055);
00223 //            mWeights.push_back(0.00210036275308617);
00224 //            mWeights.push_back(0.00393768441021206);
00225 //            mWeights.push_back(0.00393768441021206);
00226 //            mWeights.push_back(0.00210036275308617);
00227 //            mPoints.push_back(ChastePoint<2>(0.0646110610581461,   0.0694318417));
00228 //            mPoints.push_back(ChastePoint<2>(0.307096312350118,    0.0694318417));
00229 //            mPoints.push_back(ChastePoint<2>(0.623471845949882,    0.0694318417));
00230 //            mPoints.push_back(ChastePoint<2>(0.865957097241854,    0.0694318417));
00231 //            mPoints.push_back(ChastePoint<2>(0.046518675850118,    0.3300094782));
00232 //            mPoints.push_back(ChastePoint<2>(0.221103222498164,    0.3300094782));
00233 //            mPoints.push_back(ChastePoint<2>(0.448887299301836,    0.3300094782));
00234 //            mPoints.push_back(ChastePoint<2>(0.623471845949882,    0.3300094782));
00235 //            mPoints.push_back(ChastePoint<2>(0.022913165849882,    0.6699905218));
00236 //            mPoints.push_back(ChastePoint<2>(0.108906255701836,    0.6699905218));
00237 //            mPoints.push_back(ChastePoint<2>(0.221103222498164,    0.6699905218));
00238 //            mPoints.push_back(ChastePoint<2>(0.307096312350118,    0.6699905218));
00239 //            mPoints.push_back(ChastePoint<2>(0.00482078064185386,  0.9305681583));
00240 //            mPoints.push_back(ChastePoint<2>(0.022913165849882,    0.9305681583));
00241 //            mPoints.push_back(ChastePoint<2>(0.046518675850118,    0.9305681583));
00242 //            mPoints.push_back(ChastePoint<2>(0.0646110610581462,   0.9305681583));
00243 //            break;
00244 //        case 5:
00245 //            mWeights.push_back(0.013375270551691);
00246 //            mWeights.push_back(0.0270200993092602);
00247 //            mWeights.push_back(0.0321155735571689);
00248 //            mWeights.push_back(0.0270200993092602);
00249 //            mWeights.push_back(0.013375270551691);
00250 //            mWeights.push_back(0.0218078024655245);
00251 //            mWeights.push_back(0.0440551079739245);
00252 //            mWeights.push_back(0.0523630592364514);
00253 //            mWeights.push_back(0.0440551079739245);
00254 //            mWeights.push_back(0.0218078024655245);
00255 //            mWeights.push_back(0.0168481340447735);
00256 //            mWeights.push_back(0.0340358165695537);
00257 //            mWeights.push_back(0.0404543209892346);
00258 //            mWeights.push_back(0.0340358165695537);
00259 //            mWeights.push_back(0.0168481340447735);
00260 //            mWeights.push_back(0.00654219752778963);
00261 //            mWeights.push_back(0.0132162430822249);
00262 //            mWeights.push_back(0.0157085739026559);
00263 //            mWeights.push_back(0.0132162430822249);
00264 //            mWeights.push_back(0.00654219752778963);
00265 //            mWeights.push_back(0.000658316657259778);
00266 //            mWeights.push_back(0.00132990068405387);
00267 //            mWeights.push_back(0.00158069453237811);
00268 //            mWeights.push_back(0.00132990068405387);
00269 //            mWeights.push_back(0.000658316657259778);
00270 //            mPoints.push_back(ChastePoint<2>(0.0447095217211631,  0.04691007705));
00271 //            mPoints.push_back(ChastePoint<2>( 0.219940124837926,  0.04691007705));
00272 //            mPoints.push_back(ChastePoint<2>(    0.476544961475,  0.04691007705));
00273 //            mPoints.push_back(ChastePoint<2>( 0.733149798112074,  0.04691007705));
00274 //            mPoints.push_back(ChastePoint<2>( 0.908380401228837,  0.04691007705));
00275 //            mPoints.push_back(ChastePoint<2>(0.0360848569379257,  0.23076534495));
00276 //            mPoints.push_back(ChastePoint<2>( 0.177512700520108,  0.23076534495));
00277 //            mPoints.push_back(ChastePoint<2>(    0.384617327525,  0.23076534495));
00278 //            mPoints.push_back(ChastePoint<2>( 0.591721954529893,  0.23076534495));
00279 //            mPoints.push_back(ChastePoint<2>( 0.733149798112074,  0.23076534495));
00280 //            mPoints.push_back(ChastePoint<2>(    0.023455038525,            0.5));
00281 //            mPoints.push_back(ChastePoint<2>(    0.115382672475,            0.5));
00282 //            mPoints.push_back(ChastePoint<2>(              0.25,            0.5));
00283 //            mPoints.push_back(ChastePoint<2>(    0.384617327525,            0.5));
00284 //            mPoints.push_back(ChastePoint<2>(    0.476544961475,            0.5));
00285 //            mPoints.push_back(ChastePoint<2>(0.0108252201120743,  0.76923465505));
00286 //            mPoints.push_back(ChastePoint<2>(0.0532526444298925,  0.76923465505));
00287 //            mPoints.push_back(ChastePoint<2>(    0.115382672475,  0.76923465505));
00288 //            mPoints.push_back(ChastePoint<2>( 0.177512700520108,  0.76923465505));
00289 //            mPoints.push_back(ChastePoint<2>( 0.219940124837926,  0.76923465505));
00290 //            mPoints.push_back(ChastePoint<2>(0.00220055532883694,  0.95308992295));
00291 //            mPoints.push_back(ChastePoint<2>(0.0108252201120743,  0.95308992295));
00292 //            mPoints.push_back(ChastePoint<2>(    0.023455038525,  0.95308992295));
00293 //            mPoints.push_back(ChastePoint<2>(0.0360848569379257,  0.95308992295));
00294 //            mPoints.push_back(ChastePoint<2>(0.0447095217211631,  0.95308992295));
00295 //            break;
00296 //        case 8:
00297 //            mWeights.push_back(0.00251093933534381);
00298 //            mWeights.push_back(0.00551608575378066);
00299 //            mWeights.push_back(0.0077813864127667);
00300 //            mWeights.push_back(0.0089962476127433);
00301 //            mWeights.push_back(0.0089962476127433);
00302 //            mWeights.push_back(0.0077813864127667);
00303 //            mWeights.push_back(0.00551608575378066);
00304 //            mWeights.push_back(0.00251093933534381);
00305 //            mWeights.push_back(0.00505566374657279);
00306 //            mWeights.push_back(0.0111063912918299);
00307 //            mWeights.push_back(0.015667472579425);
00308 //            mWeights.push_back(0.018113541124127);
00309 //            mWeights.push_back(0.018113541124127);
00310 //            mWeights.push_back(0.015667472579425);
00311 //            mWeights.push_back(0.0111063912918299);
00312 //            mWeights.push_back(0.00505566374657279);
00313 //            mWeights.push_back(0.00605561321825424);
00314 //            mWeights.push_back(0.0133031018843967);
00315 //            mWeights.push_back(0.018766310182895);
00316 //            mWeights.push_back(0.0216961816606203);
00317 //            mWeights.push_back(0.0216961816606203);
00318 //            mWeights.push_back(0.018766310182895);
00319 //            mWeights.push_back(0.0133031018843967);
00320 //            mWeights.push_back(0.00605561321825424);
00321 //            mWeights.push_back(0.00543106981966284);
00322 //            mWeights.push_back(0.0119310914598135);
00323 //            mWeights.push_back(0.0168308538189853);
00324 //            mWeights.push_back(0.0194585541004693);
00325 //            mWeights.push_back(0.0194585541004693);
00326 //            mWeights.push_back(0.0168308538189853);
00327 //            mWeights.push_back(0.0119310914598135);
00328 //            mWeights.push_back(0.00543106981966284);
00329 //            mWeights.push_back(0.00374741731366922);
00330 //            mWeights.push_back(0.00823240727740299);
00331 //            mWeights.push_back(0.0116132244841987);
00332 //            mWeights.push_back(0.0134263275848652);
00333 //            mWeights.push_back(0.0134263275848652);
00334 //            mWeights.push_back(0.0116132244841987);
00335 //            mWeights.push_back(0.00823240727740299);
00336 //            mWeights.push_back(0.00374741731366922);
00337 //            mWeights.push_back(0.00188340292975561);
00338 //            mWeights.push_back(0.00413750022679507);
00339 //            mWeights.push_back(0.00583665473756204);
00340 //            mWeights.push_back(0.00674789664256371);
00341 //            mWeights.push_back(0.00674789664256371);
00342 //            mWeights.push_back(0.00583665473756204);
00343 //            mWeights.push_back(0.00413750022679507);
00344 //            mWeights.push_back(0.00188340292975561);
00345 //            mWeights.push_back(0.000572162909255913);
00346 //            mWeights.push_back(0.00125693983449269);
00347 //            mWeights.push_back(0.00177312953176681);
00348 //            mWeights.push_back(0.00204995761308944);
00349 //            mWeights.push_back(0.00204995761308944);
00350 //            mWeights.push_back(0.00177312953176681);
00351 //            mWeights.push_back(0.00125693983449269);
00352 //            mWeights.push_back(0.000572162909255913);
00353 //            mWeights.push_back(5.0864805016297e-05);
00354 //            mWeights.push_back(0.000111740902048041);
00355 //            mWeights.push_back(0.000157629735243144);
00356 //            mWeights.push_back(0.00018223952058876);
00357 //            mWeights.push_back(0.00018223952058876);
00358 //            mWeights.push_back(0.000157629735243144);
00359 //            mWeights.push_back(0.000111740902048041);
00360 //            mWeights.push_back(5.0864805016297e-05);
00361 //            mPoints.push_back(ChastePoint<2>(0.0194608478758024,  0.01985507175));
00362 //            mPoints.push_back(ChastePoint<2>(0.0996481604597984,  0.01985507175));
00363 //            mPoints.push_back(ChastePoint<2>(0.232523501027757,  0.01985507175));
00364 //            mPoints.push_back(ChastePoint<2>(0.400176196869137,  0.01985507175));
00365 //            mPoints.push_back(ChastePoint<2>(0.579968731380863,  0.01985507175));
00366 //            mPoints.push_back(ChastePoint<2>(0.747621427222243,  0.01985507175));
00367 //            mPoints.push_back(ChastePoint<2>(0.880496767790202,  0.01985507175));
00368 //            mPoints.push_back(ChastePoint<2>(0.960684080374198,  0.01985507175));
00369 //            mPoints.push_back(ChastePoint<2>(0.0178364709097984,   0.1016667613));
00370 //            mPoints.push_back(ChastePoint<2>(0.0913306309467688,   0.1016667613));
00371 //            mPoints.push_back(ChastePoint<2>(0.213115003436359,   0.1016667613));
00372 //            mPoints.push_back(ChastePoint<2>(0.366773901106599,   0.1016667613));
00373 //            mPoints.push_back(ChastePoint<2>(0.531559337593401,   0.1016667613));
00374 //            mPoints.push_back(ChastePoint<2>(0.685218235263642,   0.1016667613));
00375 //            mPoints.push_back(ChastePoint<2>(0.807002607753231,   0.1016667613));
00376 //            mPoints.push_back(ChastePoint<2>(0.880496767790202,   0.1016667613));
00377 //            mPoints.push_back(ChastePoint<2>(0.0151447777277575,  0.23723379505));
00378 //            mPoints.push_back(ChastePoint<2>(0.0775479696863585,  0.23723379505));
00379 //            mPoints.push_back(ChastePoint<2>(0.180953921536175,  0.23723379505));
00380 //            mPoints.push_back(ChastePoint<2>(0.311424229416958,  0.23723379505));
00381 //            mPoints.push_back(ChastePoint<2>(0.451341975533043,  0.23723379505));
00382 //            mPoints.push_back(ChastePoint<2>(0.581812283413825,  0.23723379505));
00383 //            mPoints.push_back(ChastePoint<2>(0.685218235263642,  0.23723379505));
00384 //            mPoints.push_back(ChastePoint<2>(0.747621427222243,  0.23723379505));
00385 //            mPoints.push_back(ChastePoint<2>(0.0117485898691365,  0.40828267875));
00386 //            mPoints.push_back(ChastePoint<2>(0.0601579836565992,  0.40828267875));
00387 //            mPoints.push_back(ChastePoint<2>(0.140375345716958,  0.40828267875));
00388 //            mPoints.push_back(ChastePoint<2>(0.241587932982724,  0.40828267875));
00389 //            mPoints.push_back(ChastePoint<2>(0.350129388267276,  0.40828267875));
00390 //            mPoints.push_back(ChastePoint<2>(0.451341975533043,  0.40828267875));
00391 //            mPoints.push_back(ChastePoint<2>(0.531559337593401,  0.40828267875));
00392 //            mPoints.push_back(ChastePoint<2>(0.579968731380863,  0.40828267875));
00393 //            mPoints.push_back(ChastePoint<2>(0.00810648188086345,  0.59171732125));
00394 //            mPoints.push_back(ChastePoint<2>(0.0415087776434008,  0.59171732125));
00395 //            mPoints.push_back(ChastePoint<2>(0.0968584493330425,  0.59171732125));
00396 //            mPoints.push_back(ChastePoint<2>(0.166694745767276,  0.59171732125));
00397 //            mPoints.push_back(ChastePoint<2>(0.241587932982724,  0.59171732125));
00398 //            mPoints.push_back(ChastePoint<2>(0.311424229416958,  0.59171732125));
00399 //            mPoints.push_back(ChastePoint<2>(0.366773901106599,  0.59171732125));
00400 //            mPoints.push_back(ChastePoint<2>(0.400176196869137,  0.59171732125));
00401 //            mPoints.push_back(ChastePoint<2>(0.00471029402224254,  0.76276620495));
00402 //            mPoints.push_back(ChastePoint<2>(0.0241187916136415,  0.76276620495));
00403 //            mPoints.push_back(ChastePoint<2>(0.0562798735138254,  0.76276620495));
00404 //            mPoints.push_back(ChastePoint<2>(0.0968584493330425,  0.76276620495));
00405 //            mPoints.push_back(ChastePoint<2>(0.140375345716957,  0.76276620495));
00406 //            mPoints.push_back(ChastePoint<2>(0.180953921536175,  0.76276620495));
00407 //            mPoints.push_back(ChastePoint<2>(0.213115003436359,  0.76276620495));
00408 //            mPoints.push_back(ChastePoint<2>(0.232523501027757,  0.76276620495));
00409 //            mPoints.push_back(ChastePoint<2>(0.00201860084020162,   0.8983332387));
00410 //            mPoints.push_back(ChastePoint<2>(0.0103361303532312,   0.8983332387));
00411 //            mPoints.push_back(ChastePoint<2>(0.0241187916136415,   0.8983332387));
00412 //            mPoints.push_back(ChastePoint<2>(0.0415087776434008,   0.8983332387));
00413 //            mPoints.push_back(ChastePoint<2>(0.0601579836565991,   0.8983332387));
00414 //            mPoints.push_back(ChastePoint<2>(0.0775479696863585,   0.8983332387));
00415 //            mPoints.push_back(ChastePoint<2>(0.0913306309467688,   0.8983332387));
00416 //            mPoints.push_back(ChastePoint<2>(0.0996481604597983,   0.8983332387));
00417 //            mPoints.push_back(ChastePoint<2>(0.000394223874197648,  0.98014492825));
00418 //            mPoints.push_back(ChastePoint<2>(0.00201860084020162,  0.98014492825));
00419 //            mPoints.push_back(ChastePoint<2>(0.00471029402224255,  0.98014492825));
00420 //            mPoints.push_back(ChastePoint<2>(0.00810648188086345,  0.98014492825));
00421 //            mPoints.push_back(ChastePoint<2>(0.0117485898691366,  0.98014492825));
00422 //            mPoints.push_back(ChastePoint<2>(0.0151447777277575,  0.98014492825));
00423 //            mPoints.push_back(ChastePoint<2>(0.0178364709097984,  0.98014492825));
00424 //            mPoints.push_back(ChastePoint<2>(0.0194608478758024,  0.98014492825));
00425 //            break;
00426         default:
00427             EXCEPTION("Number of gauss points per dimension not supported.");
00428     }
00429 }
00430 
00436 template<>
00437 GaussianQuadratureRule<3>::GaussianQuadratureRule(unsigned numPointsInEachDimension)
00438 {
00439     mNumQuadPoints = numPointsInEachDimension * numPointsInEachDimension * numPointsInEachDimension;
00440 
00441     mWeights.reserve(mNumQuadPoints);
00442     mPoints.reserve(mNumQuadPoints);
00443 
00444     switch (numPointsInEachDimension)
00445     {
00446         case 1: //3d, 1 point per dimension
00447             mWeights.push_back(0.12500000000000);
00448             mPoints.push_back(ChastePoint<3>(0.25000000000000,0.50000000000000,0.12500000000000));
00449             break;
00450 
00451         case 2: //3d, 2 points per dimension
00452             mWeights.push_back(0.06132032652029);
00453             mWeights.push_back(0.01643073197073);
00454             mWeights.push_back(0.00440260136261);
00455             mWeights.push_back(0.00117967347971);
00456             mWeights.push_back(0.06132032652029);
00457             mWeights.push_back(0.01643073197073);
00458             mWeights.push_back(0.00440260136261);
00459             mWeights.push_back(0.00117967347971);
00460 
00461             mPoints.push_back(ChastePoint<3>(0.16666666666667,   0.21132486540519,   0.13144585576580));
00462             mPoints.push_back(ChastePoint<3>(0.62200846792815,   0.21132486540519,   0.03522081090086));
00463             mPoints.push_back(ChastePoint<3>(0.04465819873852,   0.78867513459481,   0.03522081090086));
00464             mPoints.push_back(ChastePoint<3>(0.16666666666667,   0.78867513459481,   0.00943738783766));
00465             mPoints.push_back(ChastePoint<3>(0.16666666666667,   0.21132486540519,   0.49056261216234));
00466             mPoints.push_back(ChastePoint<3>(0.62200846792815,   0.21132486540519,   0.13144585576580));
00467             mPoints.push_back(ChastePoint<3>(0.04465819873852,   0.78867513459481,   0.13144585576580));
00468             mPoints.push_back(ChastePoint<3>(0.16666666666667,   0.78867513459481,   0.03522081090086));
00469             break;
00470 
00471         case 3: //3d, 3 points per dimension
00472             mWeights.push_back(0.01497274736603);
00473             mWeights.push_back(0.01349962850795);
00474             mWeights.push_back(0.00190178826891);
00475             mWeights.push_back(0.00760715307442);
00476             mWeights.push_back(0.00685871056241);
00477             mWeights.push_back(0.00096623512860);
00478             mWeights.push_back(0.00024155878219);
00479             mWeights.push_back(0.00021779261632);
00480             mWeights.push_back(0.00003068198821);
00481             mWeights.push_back(0.02395639578565);
00482             mWeights.push_back(0.02159940561273);
00483             mWeights.push_back(0.00304286123026);
00484             mWeights.push_back(0.01217144491907);
00485             mWeights.push_back(0.01097393689986);
00486             mWeights.push_back(0.00154597620576);
00487             mWeights.push_back(0.00038649405150);
00488             mWeights.push_back(0.00034846818612);
00489             mWeights.push_back(0.00004909118114);
00490             mWeights.push_back(0.01497274736603);
00491             mWeights.push_back(0.01349962850795);
00492             mWeights.push_back(0.00190178826891);
00493             mWeights.push_back(0.00760715307442);
00494             mWeights.push_back(0.00685871056241);
00495             mWeights.push_back(0.00096623512860);
00496             mWeights.push_back(0.00024155878219);
00497             mWeights.push_back(0.00021779261632);
00498             mWeights.push_back(0.00003068198821);
00499 
00500             mPoints.push_back(ChastePoint<3>(0.10000000001607,   0.11270166540000,   0.08872983347426));
00501             mPoints.push_back(ChastePoint<3>(0.44364916730000,   0.11270166540000,   0.05000000000803));
00502             mPoints.push_back(ChastePoint<3>(0.78729833458393,   0.11270166540000,   0.01127016654181));
00503             mPoints.push_back(ChastePoint<3>(0.05635083270000,   0.50000000000000,   0.05000000000803));
00504             mPoints.push_back(ChastePoint<3>(0.25000000000000,   0.50000000000000,   0.02817541635000));
00505             mPoints.push_back(ChastePoint<3>(0.44364916730000,   0.50000000000000,   0.00635083269197));
00506             mPoints.push_back(ChastePoint<3>(0.01270166538393,   0.88729833460000,   0.01127016654181));
00507             mPoints.push_back(ChastePoint<3>(0.05635083270000,   0.88729833460000,   0.00635083269197));
00508             mPoints.push_back(ChastePoint<3>(0.10000000001607,   0.88729833460000,   0.00143149884212));
00509             mPoints.push_back(ChastePoint<3>(0.10000000001607,   0.11270166540000,   0.39364916729197));
00510             mPoints.push_back(ChastePoint<3>(0.44364916730000,   0.11270166540000,   0.22182458365000));
00511             mPoints.push_back(ChastePoint<3>(0.78729833458393,   0.11270166540000,   0.05000000000803));
00512             mPoints.push_back(ChastePoint<3>(0.05635083270000,   0.50000000000000,   0.22182458365000));
00513             mPoints.push_back(ChastePoint<3>(0.25000000000000,   0.50000000000000,   0.12500000000000));
00514             mPoints.push_back(ChastePoint<3>(0.44364916730000,   0.50000000000000,   0.02817541635000));
00515             mPoints.push_back(ChastePoint<3>(0.01270166538393,   0.88729833460000,   0.05000000000803));
00516             mPoints.push_back(ChastePoint<3>(0.05635083270000,   0.88729833460000,   0.02817541635000));
00517             mPoints.push_back(ChastePoint<3>(0.10000000001607,   0.88729833460000,   0.00635083269197));
00518             mPoints.push_back(ChastePoint<3>(0.10000000001607,   0.11270166540000,   0.69856850110968));
00519             mPoints.push_back(ChastePoint<3>(0.44364916730000,   0.11270166540000,   0.39364916729197));
00520             mPoints.push_back(ChastePoint<3>(0.78729833458393,   0.11270166540000,   0.08872983347426));
00521             mPoints.push_back(ChastePoint<3>(0.05635083270000,   0.50000000000000,   0.39364916729197));
00522             mPoints.push_back(ChastePoint<3>(0.25000000000000,   0.50000000000000,   0.22182458365000));
00523             mPoints.push_back(ChastePoint<3>(0.44364916730000,   0.50000000000000,   0.05000000000803));
00524             mPoints.push_back(ChastePoint<3>(0.01270166538393,   0.88729833460000,   0.08872983347426));
00525             mPoints.push_back(ChastePoint<3>(0.05635083270000,   0.88729833460000,   0.05000000000803));
00526             mPoints.push_back(ChastePoint<3>(0.10000000001607,   0.88729833460000,   0.01127016654181));
00527             break;
00528 
00529         case 4: //3d, 4 points per dimension
00530             mWeights.push_back(0.00423982561968);
00531             mWeights.push_back(0.00572288385156);
00532             mWeights.push_back(0.00281885467361);
00533             mWeights.push_back(0.00031634320391);
00534             mWeights.push_back(0.00412036229051);
00535             mWeights.push_back(0.00556163317318);
00536             mWeights.push_back(0.00273942929295);
00537             mWeights.push_back(0.00030742976838);
00538             mWeights.push_back(0.00099965677330);
00539             mWeights.push_back(0.00134932898618);
00540             mWeights.push_back(0.00066462336430);
00541             mWeights.push_back(0.00007458670588);
00542             mWeights.push_back(0.00002360309872);
00543             mWeights.push_back(0.00003185928022);
00544             mWeights.push_back(0.00001569255698);
00545             mWeights.push_back(0.00000176108183);
00546             mWeights.push_back(0.00794866986669);
00547             mWeights.push_back(0.01072905315027);
00548             mWeights.push_back(0.00528468555374);
00549             mWeights.push_back(0.00059306865848);
00550             mWeights.push_back(0.00772470439029);
00551             mWeights.push_back(0.01042674628127);
00552             mWeights.push_back(0.00513578175757);
00553             mWeights.push_back(0.00057635807584);
00554             mWeights.push_back(0.00187411992466);
00555             mWeights.push_back(0.00252967258912);
00556             mWeights.push_back(0.00124601155388);
00557             mWeights.push_back(0.00013983242583);
00558             mWeights.push_back(0.00004425022545);
00559             mWeights.push_back(0.00005972861231);
00560             mWeights.push_back(0.00002941983138);
00561             mWeights.push_back(0.00000330161175);
00562             mWeights.push_back(0.00794866986669);
00563             mWeights.push_back(0.01072905315027);
00564             mWeights.push_back(0.00528468555374);
00565             mWeights.push_back(0.00059306865848);
00566             mWeights.push_back(0.00772470439029);
00567             mWeights.push_back(0.01042674628127);
00568             mWeights.push_back(0.00513578175757);
00569             mWeights.push_back(0.00057635807584);
00570             mWeights.push_back(0.00187411992466);
00571             mWeights.push_back(0.00252967258912);
00572             mWeights.push_back(0.00124601155388);
00573             mWeights.push_back(0.00013983242583);
00574             mWeights.push_back(0.00004425022545);
00575             mWeights.push_back(0.00005972861231);
00576             mWeights.push_back(0.00002941983138);
00577             mWeights.push_back(0.00000330161175);
00578             mWeights.push_back(0.00423982561968);
00579             mWeights.push_back(0.00572288385156);
00580             mWeights.push_back(0.00281885467361);
00581             mWeights.push_back(0.00031634320391);
00582             mWeights.push_back(0.00412036229051);
00583             mWeights.push_back(0.00556163317318);
00584             mWeights.push_back(0.00273942929295);
00585             mWeights.push_back(0.00030742976838);
00586             mWeights.push_back(0.00099965677330);
00587             mWeights.push_back(0.00134932898618);
00588             mWeights.push_back(0.00066462336430);
00589             mWeights.push_back(0.00007458670588);
00590             mWeights.push_back(0.00002360309872);
00591             mWeights.push_back(0.00003185928022);
00592             mWeights.push_back(0.00001569255698);
00593             mWeights.push_back(0.00000176108183);
00594 
00595             mPoints.push_back(ChastePoint<3>(0.06461106321099,   0.06943184420000,   0.06012499793653));
00596             mPoints.push_back(ChastePoint<3>(0.30709631152509,   0.06943184420000,   0.04328879995478));
00597             mPoints.push_back(ChastePoint<3>(0.62347184427491,   0.06943184420000,   0.02132226325621));
00598             mPoints.push_back(ChastePoint<3>(0.86595709258901,   0.06943184420000,   0.00448606527446));
00599             mPoints.push_back(ChastePoint<3>(0.04651867752509,   0.33000947820000,   0.04328879995478));
00600             mPoints.push_back(ChastePoint<3>(0.22110322249816,   0.33000947820000,   0.03116707302848));
00601             mPoints.push_back(ChastePoint<3>(0.44888729930184,   0.33000947820000,   0.01535160449661));
00602             mPoints.push_back(ChastePoint<3>(0.62347184427491,   0.33000947820000,   0.00322987757031));
00603             mPoints.push_back(ChastePoint<3>(0.02291316667491,   0.66999052180000,   0.02132226325621));
00604             mPoints.push_back(ChastePoint<3>(0.10890625570184,   0.66999052180000,   0.01535160449661));
00605             mPoints.push_back(ChastePoint<3>(0.22110322249816,   0.66999052180000,   0.00756156217830));
00606             mPoints.push_back(ChastePoint<3>(0.30709631152509,   0.66999052180000,   0.00159090341870));
00607             mPoints.push_back(ChastePoint<3>(0.00482078098901,   0.93056815580000,   0.00448606527446));
00608             mPoints.push_back(ChastePoint<3>(0.02291316667491,   0.93056815580000,   0.00322987757031));
00609             mPoints.push_back(ChastePoint<3>(0.04651867752509,   0.93056815580000,   0.00159090341870));
00610             mPoints.push_back(ChastePoint<3>(0.06461106321099,   0.93056815580000,   0.00033471571455));
00611             mPoints.push_back(ChastePoint<3>(0.06461106321099,   0.06943184420000,   0.28577404826889));
00612             mPoints.push_back(ChastePoint<3>(0.30709631152509,   0.06943184420000,   0.20575161800155));
00613             mPoints.push_back(ChastePoint<3>(0.62347184427491,   0.06943184420000,   0.10134469352354));
00614             mPoints.push_back(ChastePoint<3>(0.86595709258901,   0.06943184420000,   0.02132226325621));
00615             mPoints.push_back(ChastePoint<3>(0.04651867752509,   0.33000947820000,   0.20575161800155));
00616             mPoints.push_back(ChastePoint<3>(0.22110322249816,   0.33000947820000,   0.14813706341321));
00617             mPoints.push_back(ChastePoint<3>(0.44888729930184,   0.33000947820000,   0.07296615908496));
00618             mPoints.push_back(ChastePoint<3>(0.62347184427491,   0.33000947820000,   0.01535160449661));
00619             mPoints.push_back(ChastePoint<3>(0.02291316667491,   0.66999052180000,   0.10134469352354));
00620             mPoints.push_back(ChastePoint<3>(0.10890625570184,   0.66999052180000,   0.07296615908496));
00621             mPoints.push_back(ChastePoint<3>(0.22110322249816,   0.66999052180000,   0.03594009661688));
00622             mPoints.push_back(ChastePoint<3>(0.30709631152509,   0.66999052180000,   0.00756156217830));
00623             mPoints.push_back(ChastePoint<3>(0.00482078098901,   0.93056815580000,   0.02132226325621));
00624             mPoints.push_back(ChastePoint<3>(0.02291316667491,   0.93056815580000,   0.01535160449661));
00625             mPoints.push_back(ChastePoint<3>(0.04651867752509,   0.93056815580000,   0.00756156217830));
00626             mPoints.push_back(ChastePoint<3>(0.06461106321099,   0.93056815580000,   0.00159090341870));
00627             mPoints.push_back(ChastePoint<3>(0.06461106321099,   0.06943184420000,   0.58018304432012));
00628             mPoints.push_back(ChastePoint<3>(0.30709631152509,   0.06943184420000,   0.41772022627335));
00629             mPoints.push_back(ChastePoint<3>(0.62347184427491,   0.06943184420000,   0.20575161800155));
00630             mPoints.push_back(ChastePoint<3>(0.86595709258901,   0.06943184420000,   0.04328879995478));
00631             mPoints.push_back(ChastePoint<3>(0.04651867752509,   0.33000947820000,   0.41772022627335));
00632             mPoints.push_back(ChastePoint<3>(0.22110322249816,   0.33000947820000,   0.30075023588863));
00633             mPoints.push_back(ChastePoint<3>(0.44888729930184,   0.33000947820000,   0.14813706341321));
00634             mPoints.push_back(ChastePoint<3>(0.62347184427491,   0.33000947820000,   0.03116707302848));
00635             mPoints.push_back(ChastePoint<3>(0.02291316667491,   0.66999052180000,   0.20575161800155));
00636             mPoints.push_back(ChastePoint<3>(0.10890625570184,   0.66999052180000,   0.14813706341321));
00637             mPoints.push_back(ChastePoint<3>(0.22110322249816,   0.66999052180000,   0.07296615908496));
00638             mPoints.push_back(ChastePoint<3>(0.30709631152509,   0.66999052180000,   0.01535160449661));
00639             mPoints.push_back(ChastePoint<3>(0.00482078098901,   0.93056815580000,   0.04328879995478));
00640             mPoints.push_back(ChastePoint<3>(0.02291316667491,   0.93056815580000,   0.03116707302848));
00641             mPoints.push_back(ChastePoint<3>(0.04651867752509,   0.93056815580000,   0.01535160449661));
00642             mPoints.push_back(ChastePoint<3>(0.06461106321099,   0.93056815580000,   0.00322987757031));
00643             mPoints.push_back(ChastePoint<3>(0.06461106321099,   0.06943184420000,   0.80583209465249));
00644             mPoints.push_back(ChastePoint<3>(0.30709631152509,   0.06943184420000,   0.58018304432012));
00645             mPoints.push_back(ChastePoint<3>(0.62347184427491,   0.06943184420000,   0.28577404826889));
00646             mPoints.push_back(ChastePoint<3>(0.86595709258901,   0.06943184420000,   0.06012499793653));
00647             mPoints.push_back(ChastePoint<3>(0.04651867752509,   0.33000947820000,   0.58018304432012));
00648             mPoints.push_back(ChastePoint<3>(0.22110322249816,   0.33000947820000,   0.41772022627335));
00649             mPoints.push_back(ChastePoint<3>(0.44888729930184,   0.33000947820000,   0.20575161800155));
00650             mPoints.push_back(ChastePoint<3>(0.62347184427491,   0.33000947820000,   0.04328879995478));
00651             mPoints.push_back(ChastePoint<3>(0.02291316667491,   0.66999052180000,   0.28577404826889));
00652             mPoints.push_back(ChastePoint<3>(0.10890625570184,   0.66999052180000,   0.20575161800155));
00653             mPoints.push_back(ChastePoint<3>(0.22110322249816,   0.66999052180000,   0.10134469352354));
00654             mPoints.push_back(ChastePoint<3>(0.30709631152509,   0.66999052180000,   0.02132226325621));
00655             mPoints.push_back(ChastePoint<3>(0.00482078098901,   0.93056815580000,   0.06012499793653));
00656             mPoints.push_back(ChastePoint<3>(0.02291316667491,   0.93056815580000,   0.04328879995478));
00657             mPoints.push_back(ChastePoint<3>(0.04651867752509,   0.93056815580000,   0.02132226325621));
00658             mPoints.push_back(ChastePoint<3>(0.06461106321099,   0.93056815580000,   0.00448606527446));
00659             break;
00660 
00661         default:
00662             EXCEPTION("Number of gauss points per dimension not supported.");
00663     }
00664 }
00665 
00666 template<unsigned ELEMENT_DIM>
00667 GaussianQuadratureRule<ELEMENT_DIM>::GaussianQuadratureRule(unsigned numPointsInEachDimension)
00668 {
00669     EXCEPTION("Gauss points not available for this dimension.");
00670 }
00671 
00673 // Explicit instantiation
00675 
00676 template class GaussianQuadratureRule<0>;
00677 template class GaussianQuadratureRule<1>;
00678 template class GaussianQuadratureRule<2>;
00679 template class GaussianQuadratureRule<3>;
00680 template class GaussianQuadratureRule<4>;