00001
00002
00003
00004
00005
00006
00007 #include "Teuchos_TestForException.hpp"
00008 #include "Phalanx_DataLayout.hpp"
00009
00010 #include "Intrepid_FunctionSpaceTools.hpp"
00011
00012 namespace PHAL {
00013
00014
00015 template<typename EvalT, typename Traits>
00016 ComputeBasisFunctions<EvalT, Traits>::
00017 ComputeBasisFunctions(const Teuchos::ParameterList& p,
00018 const Teuchos::RCP<Albany::Layouts>& dl) :
00019 coordVec (p.get<std::string> ("Coordinate Vector Name"), dl->vertices_vector ),
00020 cubature (p.get<Teuchos::RCP <Intrepid::Cubature<RealType> > >("Cubature")),
00021 intrepidBasis (p.get<Teuchos::RCP<Intrepid::Basis<RealType, Intrepid::FieldContainer<RealType> > > > ("Intrepid Basis") ),
00022 cellType (p.get<Teuchos::RCP <shards::CellTopology> > ("Cell Type")),
00023 weighted_measure (p.get<std::string> ("Weights Name"), dl->qp_scalar ),
00024 jacobian_det (p.get<std::string> ("Jacobian Det Name"), dl->qp_scalar ),
00025 BF (p.get<std::string> ("BF Name"), dl->node_qp_scalar),
00026 wBF (p.get<std::string> ("Weighted BF Name"), dl->node_qp_scalar),
00027 GradBF (p.get<std::string> ("Gradient BF Name"), dl->node_qp_gradient),
00028 wGradBF (p.get<std::string> ("Weighted Gradient BF Name"), dl->node_qp_gradient)
00029 {
00030 this->addDependentField(coordVec);
00031 this->addEvaluatedField(weighted_measure);
00032 this->addEvaluatedField(jacobian_det);
00033 this->addEvaluatedField(BF);
00034 this->addEvaluatedField(wBF);
00035 this->addEvaluatedField(GradBF);
00036 this->addEvaluatedField(wGradBF);
00037
00038
00039 std::vector<PHX::DataLayout::size_type> dim;
00040 dl->node_qp_gradient->dimensions(dim);
00041
00042 int containerSize = dim[0];
00043 numNodes = dim[1];
00044 numQPs = dim[2];
00045 numDims = dim[3];
00046
00047
00048 std::vector<PHX::DataLayout::size_type> dims;
00049 dl->vertices_vector->dimensions(dims);
00050 numVertices = dims[1];
00051
00052
00053 val_at_cub_points.resize(numNodes, numQPs);
00054 grad_at_cub_points.resize(numNodes, numQPs, numDims);
00055 refPoints.resize(numQPs, numDims);
00056 refWeights.resize(numQPs);
00057 jacobian.resize(containerSize, numQPs, numDims, numDims);
00058 jacobian_inv.resize(containerSize, numQPs, numDims, numDims);
00059
00060
00061 cubature->getCubature(refPoints, refWeights);
00062 intrepidBasis->getValues(val_at_cub_points, refPoints, Intrepid::OPERATOR_VALUE);
00063 intrepidBasis->getValues(grad_at_cub_points, refPoints, Intrepid::OPERATOR_GRAD);
00064
00065 this->setName("ComputeBasisFunctions"+PHX::TypeString<EvalT>::value);
00066 }
00067
00068
00069 template<typename EvalT, typename Traits>
00070 void ComputeBasisFunctions<EvalT, Traits>::
00071 postRegistrationSetup(typename Traits::SetupData d,
00072 PHX::FieldManager<Traits>& fm)
00073 {
00074 this->utils.setFieldData(coordVec,fm);
00075 this->utils.setFieldData(weighted_measure,fm);
00076 this->utils.setFieldData(jacobian_det,fm);
00077 this->utils.setFieldData(BF,fm);
00078 this->utils.setFieldData(wBF,fm);
00079 this->utils.setFieldData(GradBF,fm);
00080 this->utils.setFieldData(wGradBF,fm);
00081 }
00082
00083
00084 template<typename EvalT, typename Traits>
00085 void ComputeBasisFunctions<EvalT, Traits>::
00086 evaluateFields(typename Traits::EvalData workset)
00087 {
00088
00097
00098
00099
00100 Intrepid::CellTools<RealType>::setJacobian(jacobian, refPoints, coordVec, *cellType);
00101 Intrepid::CellTools<MeshScalarT>::setJacobianInv(jacobian_inv, jacobian);
00102 Intrepid::CellTools<MeshScalarT>::setJacobianDet(jacobian_det, jacobian);
00103
00104 Intrepid::FunctionSpaceTools::computeCellMeasure<MeshScalarT>
00105 (weighted_measure, jacobian_det, refWeights);
00106 Intrepid::FunctionSpaceTools::HGRADtransformVALUE<RealType>
00107 (BF, val_at_cub_points);
00108 Intrepid::FunctionSpaceTools::multiplyMeasure<MeshScalarT>
00109 (wBF, weighted_measure, BF);
00110 Intrepid::FunctionSpaceTools::HGRADtransformGRAD<MeshScalarT>
00111 (GradBF, jacobian_inv, grad_at_cub_points);
00112 Intrepid::FunctionSpaceTools::multiplyMeasure<MeshScalarT>
00113 (wGradBF, weighted_measure, GradBF);
00114 }
00115
00116
00117 }