00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 template <typename ScalarT>
00033 FEApp::GlobalFill<ScalarT>::
00034 GlobalFill(
00035 const Teuchos::RCP<const FEApp::Mesh>& elementMesh,
00036 const Teuchos::RCP<const FEApp::AbstractQuadrature>& quadRule,
00037 const Teuchos::RCP< FEApp::AbstractPDE<ScalarT> >& pdeEquations,
00038 const std::vector< Teuchos::RCP<FEApp::NodeBC> >& nodeBCs,
00039 bool is_transient):
00040 mesh(elementMesh),
00041 quad(quadRule),
00042 pde(pdeEquations),
00043 bc(nodeBCs),
00044 transient(is_transient),
00045 nnode(0),
00046 neqn(pde->numEquations()),
00047 ndof(0),
00048 elem_x(),
00049 elem_xdot(NULL),
00050 elem_f(),
00051 node_x(),
00052 node_xdot(NULL),
00053 node_f()
00054 {
00055 Teuchos::RCP<const FEApp::AbstractElement> e0 = *(mesh->begin());
00056 nnode = e0->numNodes();
00057 ndof = nnode*neqn;
00058 elem_x.resize(ndof);
00059 if (transient)
00060 elem_xdot = new std::vector<ScalarT>(ndof);
00061 elem_f.resize(ndof);
00062
00063 node_x.resize(neqn);
00064 if (transient)
00065 node_xdot = new std::vector<ScalarT>(neqn);
00066 node_f.resize(neqn);
00067 }
00068
00069 template <typename ScalarT>
00070 FEApp::GlobalFill<ScalarT>::
00071 ~GlobalFill()
00072 {
00073 if (transient) {
00074 delete elem_xdot;
00075 delete node_xdot;
00076 }
00077 }
00078
00079 template <typename ScalarT>
00080 void
00081 FEApp::GlobalFill<ScalarT>::
00082 computeGlobalFill(FEApp::AbstractInitPostOp<ScalarT>& initPostOp)
00083 {
00084
00085 Teuchos::RCP<const FEApp::AbstractElement> e;
00086 for (FEApp::Mesh::const_iterator eit=mesh->begin(); eit!=mesh->end(); ++eit){
00087 e = *eit;
00088
00089
00090 for (unsigned int i=0; i<ndof; i++)
00091 elem_f[i] = 0.0;
00092
00093
00094 initPostOp.elementInit(*e, neqn, elem_xdot, elem_x);
00095
00096
00097 pde->evaluateElementResidual(*quad, *e, elem_xdot, elem_x, elem_f);
00098
00099
00100 initPostOp.elementPost(*e, neqn, elem_f);
00101
00102 }
00103
00104
00105 for (std::size_t i=0; i<bc.size(); i++) {
00106
00107 if (bc[i]->isOwned() || bc[i]->isShared()) {
00108
00109
00110 for (unsigned int j=0; j<neqn; j++)
00111 node_f[j] = 0.0;
00112
00113
00114 initPostOp.nodeInit(*bc[i], neqn, node_xdot, node_x);
00115
00116
00117 bc[i]->getStrategy<ScalarT>()->evaluateResidual(node_xdot, node_x,
00118 node_f);
00119
00120
00121 initPostOp.nodePost(*bc[i], neqn, node_f);
00122
00123 }
00124
00125 }
00126
00127
00128 initPostOp.finalizeFill();
00129
00130 }