Intrepid
http://trilinos.sandia.gov/packages/docs/r10.12/packages/intrepid/src/Discretization/Basis/Intrepid_HDIV_HEX_I1_FEMDef.hpp
Go to the documentation of this file.
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 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Pavel Bochev  (pbboche@sandia.gov)
00038 //                    Denis Ridzal  (dridzal@sandia.gov), or
00039 //                    Kara Peterson (kjpeter@sandia.gov)
00040 //
00041 // ************************************************************************
00042 // @HEADER
00043 
00049 namespace Intrepid {
00050 
00051 template<class Scalar, class ArrayScalar>
00052 Basis_HDIV_HEX_I1_FEM<Scalar,ArrayScalar>::Basis_HDIV_HEX_I1_FEM()
00053   {
00054     this -> basisCardinality_  = 6;
00055     this -> basisDegree_       = 1;
00056     this -> basisCellTopology_ = shards::CellTopology(shards::getCellTopologyData<shards::Hexahedron<8> >() );
00057     this -> basisType_         = BASIS_FEM_DEFAULT;
00058     this -> basisCoordinates_  = COORDINATES_CARTESIAN;
00059     this -> basisTagsAreSet_   = false;
00060   }
00061   
00062 template<class Scalar, class ArrayScalar>
00063 void Basis_HDIV_HEX_I1_FEM<Scalar, ArrayScalar>::initializeTags() {
00064   
00065   // Basis-dependent intializations
00066   int tagSize  = 4;        // size of DoF tag
00067   int posScDim = 0;        // position in the tag, counting from 0, of the subcell dim 
00068   int posScOrd = 1;        // position in the tag, counting from 0, of the subcell ordinal
00069   int posDfOrd = 2;        // position in the tag, counting from 0, of DoF ordinal relative to the subcell
00070 
00071   // An array with local DoF tags assigned to basis functions, in the order of their local enumeration 
00072   int tags[]  = {
00073                   2, 0, 0, 1,
00074                   2, 1, 0, 1,
00075                   2, 2, 0, 1,
00076                   2, 3, 0, 1,
00077                   2, 4, 0, 1,
00078                   2, 5, 0, 1,
00079                 };
00080   
00081   // Basis-independent function sets tag and enum data in tagToOrdinal_ and ordinalToTag_ arrays:
00082   Intrepid::setOrdinalTagData(this -> tagToOrdinal_,
00083                               this -> ordinalToTag_,
00084                               tags,
00085                               this -> basisCardinality_,
00086                               tagSize,
00087                               posScDim,
00088                               posScOrd,
00089                               posDfOrd);
00090 }
00091 
00092 
00093 
00094 template<class Scalar, class ArrayScalar>
00095 void Basis_HDIV_HEX_I1_FEM<Scalar, ArrayScalar>::getValues(ArrayScalar &        outputValues,
00096                                                            const ArrayScalar &  inputPoints,
00097                                                            const EOperator      operatorType) const {
00098   
00099 // Verify arguments
00100 #ifdef HAVE_INTREPID_DEBUG
00101   Intrepid::getValues_HDIV_Args<Scalar, ArrayScalar>(outputValues,
00102                                                       inputPoints,
00103                                                       operatorType,
00104                                                       this -> getBaseCellTopology(),
00105                                                       this -> getCardinality() );
00106 #endif
00107   
00108  // Number of evaluation points = dim 0 of inputPoints
00109   int dim0 = inputPoints.dimension(0);
00110 
00111   // Temporaries: (x,y,z) coordinates of the evaluation point
00112   Scalar x = 0.0;                                    
00113   Scalar y = 0.0;                                    
00114   Scalar z = 0.0;                                    
00115   
00116   switch (operatorType) {
00117     case OPERATOR_VALUE:
00118       for (int i0 = 0; i0 < dim0; i0++) {
00119         x = inputPoints(i0, 0);
00120         y = inputPoints(i0, 1);
00121         z = inputPoints(i0, 2);
00122         
00123         // outputValues is a rank-3 array with dimensions (basisCardinality_, dim0, spaceDim)
00124         outputValues(0, i0, 0) = 0.0;
00125         outputValues(0, i0, 1) = (y - 1.0)/8.0;
00126         outputValues(0, i0, 2) = 0.0;
00127 
00128         outputValues(1, i0, 0) = (1.0 + x)/8.0;
00129         outputValues(1, i0, 1) = 0.0; 
00130         outputValues(1, i0, 2) = 0.0;
00131 
00132         outputValues(2, i0, 0) = 0.0;
00133         outputValues(2, i0, 1) = (1.0 + y)/8.0;
00134         outputValues(2, i0, 2) = 0.0;
00135 
00136         outputValues(3, i0, 0) = (x - 1.0)/8.0;
00137         outputValues(3, i0, 1) = 0.0;
00138         outputValues(3, i0, 2) = 0.0;
00139 
00140         outputValues(4, i0, 0) = 0.0;
00141         outputValues(4, i0, 1) = 0.0;
00142         outputValues(4, i0, 2) = (z - 1.0)/8.0;
00143 
00144         outputValues(5, i0, 0) = 0.0;
00145         outputValues(5, i0, 1) = 0.0;
00146         outputValues(5, i0, 2) = (1.0 + z)/8.0;
00147       }
00148       break;
00149 
00150     case OPERATOR_DIV:
00151       // outputValues is a rank-2 array with dimensions (basisCardinality_, dim0)
00152       for (int i0 = 0; i0 < dim0; i0++) {
00153          outputValues(0, i0) = 0.125;
00154          outputValues(1, i0) = 0.125;
00155          outputValues(2, i0) = 0.125;
00156          outputValues(3, i0) = 0.125;
00157          outputValues(4, i0) = 0.125;
00158          outputValues(5, i0) = 0.125;
00159        }
00160       break;
00161 
00162     case OPERATOR_CURL:
00163        TEUCHOS_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_CURL), std::invalid_argument,
00164                           ">>> ERROR (Basis_HDIV_HEX_I1_FEM): CURL is invalid operator for HDIV Basis Functions");
00165       break;
00166       
00167     case OPERATOR_GRAD:
00168        TEUCHOS_TEST_FOR_EXCEPTION( (operatorType == OPERATOR_GRAD), std::invalid_argument,
00169                           ">>> ERROR (Basis_HDIV_HEX_I1_FEM): GRAD is invalid operator for HDIV Basis Functions");
00170       break;
00171 
00172     case OPERATOR_D1:
00173     case OPERATOR_D2:
00174     case OPERATOR_D3:
00175     case OPERATOR_D4:
00176     case OPERATOR_D5:
00177     case OPERATOR_D6:
00178     case OPERATOR_D7:
00179     case OPERATOR_D8:
00180     case OPERATOR_D9:
00181     case OPERATOR_D10:
00182       TEUCHOS_TEST_FOR_EXCEPTION( ( (operatorType == OPERATOR_D1)    ||
00183                             (operatorType == OPERATOR_D2)    ||
00184                             (operatorType == OPERATOR_D3)    ||
00185                             (operatorType == OPERATOR_D4)    ||
00186                             (operatorType == OPERATOR_D5)    ||
00187                             (operatorType == OPERATOR_D6)    ||
00188                             (operatorType == OPERATOR_D7)    ||
00189                             (operatorType == OPERATOR_D8)    ||
00190                             (operatorType == OPERATOR_D9)    ||
00191                             (operatorType == OPERATOR_D10) ),
00192                           std::invalid_argument,
00193                           ">>> ERROR (Basis_HDIV_HEX_I1_FEM): Invalid operator type");
00194       break;
00195       
00196     default:
00197       TEUCHOS_TEST_FOR_EXCEPTION( ( (operatorType != OPERATOR_VALUE) &&
00198                             (operatorType != OPERATOR_GRAD)  &&
00199                             (operatorType != OPERATOR_CURL)  &&
00200                             (operatorType != OPERATOR_DIV)   &&
00201                             (operatorType != OPERATOR_D1)    &&
00202                             (operatorType != OPERATOR_D2)    &&
00203                             (operatorType != OPERATOR_D3)    &&
00204                             (operatorType != OPERATOR_D4)    &&
00205                             (operatorType != OPERATOR_D5)    &&
00206                             (operatorType != OPERATOR_D6)    &&
00207                             (operatorType != OPERATOR_D7)    &&
00208                             (operatorType != OPERATOR_D8)    &&
00209                             (operatorType != OPERATOR_D9)    &&
00210                             (operatorType != OPERATOR_D10) ),
00211                           std::invalid_argument,
00212                           ">>> ERROR (Basis_HDIV_HEX_I1_FEM): Invalid operator type");
00213   }
00214 }
00215 
00216 
00217   
00218 template<class Scalar, class ArrayScalar>
00219 void Basis_HDIV_HEX_I1_FEM<Scalar, ArrayScalar>::getValues(ArrayScalar&           outputValues,
00220                                                            const ArrayScalar &    inputPoints,
00221                                                            const ArrayScalar &    cellVertices,
00222                                                            const EOperator        operatorType) const {
00223   TEUCHOS_TEST_FOR_EXCEPTION( (true), std::logic_error,
00224                       ">>> ERROR (Basis_HDIV_HEX_I1_FEM): FEM Basis calling an FVD member function");
00225 }
00226 
00227 }// namespace Intrepid