00001
00002
00003
00004
00005
00006 #include <Intrepid_MiniTensor.h>
00007
00008 #include "Teuchos_TestForException.hpp"
00009 #include "Phalanx_DataLayout.hpp"
00010
00011 namespace LCM {
00012
00013
00014 template<typename EvalT, typename Traits>
00015 SurfaceVectorJump<EvalT, Traits>::
00016 SurfaceVectorJump(const Teuchos::ParameterList& p,
00017 const Teuchos::RCP<Albany::Layouts>& dl) :
00018 cubature (p.get<Teuchos::RCP<Intrepid::Cubature<RealType> > >("Cubature")),
00019 intrepidBasis(p.get<Teuchos::RCP<Intrepid::Basis<RealType, Intrepid::FieldContainer<RealType> > > >("Intrepid Basis")),
00020 vector (p.get<std::string>("Vector Name"),dl->node_vector),
00021 jump (p.get<std::string>("Vector Jump Name"),dl->qp_vector)
00022 {
00023 this->addDependentField(vector);
00024
00025 this->addEvaluatedField(jump);
00026
00027 this->setName("Surface Vector Jump" + PHX::TypeString<EvalT>::value);
00028
00029 std::vector<PHX::DataLayout::size_type> dims;
00030 dl->node_vector->dimensions(dims);
00031 worksetSize = dims[0];
00032 numNodes = dims[1];
00033 numDims = dims[2];
00034
00035 numQPs = cubature->getNumPoints();
00036
00037 numPlaneNodes = numNodes / 2;
00038 numPlaneDims = numDims - 1;
00039
00040 #ifdef ALBANY_VERBOSE
00041 std::cout << "in Surface Vector Jump" << std::endl;
00042 std::cout << " numPlaneNodes: " << numPlaneNodes << std::endl;
00043 std::cout << " numPlaneDims: " << numPlaneDims << std::endl;
00044 std::cout << " numQPs: " << numQPs << std::endl;
00045 std::cout << " cubature->getNumPoints(): " << cubature->getNumPoints() << std::endl;
00046 std::cout << " cubature->getDimension(): " << cubature->getDimension() << std::endl;
00047 #endif
00048
00049
00050 refValues.resize(numPlaneNodes, numQPs);
00051 refGrads.resize(numPlaneNodes, numQPs, numPlaneDims);
00052 refPoints.resize(numQPs, numPlaneDims);
00053 refWeights.resize(numQPs);
00054
00055
00056 cubature->getCubature(refPoints, refWeights);
00057 intrepidBasis->getValues(refValues, refPoints, Intrepid::OPERATOR_VALUE);
00058 intrepidBasis->getValues(refGrads, refPoints, Intrepid::OPERATOR_GRAD);
00059 }
00060
00061
00062 template<typename EvalT, typename Traits>
00063 void SurfaceVectorJump<EvalT, Traits>::postRegistrationSetup(
00064 typename Traits::SetupData d, PHX::FieldManager<Traits>& fm)
00065 {
00066 this->utils.setFieldData(vector, fm);
00067 this->utils.setFieldData(jump, fm);
00068 }
00069
00070
00071 template<typename EvalT, typename Traits>
00072 void SurfaceVectorJump<EvalT, Traits>::evaluateFields(
00073 typename Traits::EvalData workset)
00074 {
00075 Intrepid::Vector<ScalarT> vecA(0, 0, 0), vecB(0, 0, 0), vecJump(0, 0, 0);
00076
00077 for (std::size_t cell = 0; cell < workset.numCells; ++cell) {
00078 for (std::size_t pt = 0; pt < numQPs; ++pt) {
00079 vecA.clear();
00080 vecB.clear();
00081 for (std::size_t node = 0; node < numPlaneNodes; ++node) {
00082 int topNode = node + numPlaneNodes;
00083 vecA += Intrepid::Vector<ScalarT>(
00084 refValues(node, pt) * vector(cell, node, 0),
00085 refValues(node, pt) * vector(cell, node, 1),
00086 refValues(node, pt) * vector(cell, node, 2));
00087 vecB += Intrepid::Vector<ScalarT>(
00088 refValues(node, pt) * vector(cell, topNode, 0),
00089 refValues(node, pt) * vector(cell, topNode, 1),
00090 refValues(node, pt) * vector(cell, topNode, 2));
00091 }
00092 vecJump = vecB - vecA;
00093 jump(cell, pt, 0) = vecJump(0);
00094 jump(cell, pt, 1) = vecJump(1);
00095 jump(cell, pt, 2) = vecJump(2);
00096 }
00097 }
00098 }
00099
00100
00101 }
00102