00001
00002
00003
00004
00005
00006
00007 #include <fstream>
00008 #include "Teuchos_Array.hpp"
00009 #include "Teuchos_TestForException.hpp"
00010 #include "Teuchos_CommHelpers.hpp"
00011 #include "Phalanx_DataLayout.hpp"
00012 #include "Sacado_ParameterRegistration.hpp"
00013
00014
00015 template<typename EvalT, typename Traits>
00016 QCAD::ResponseSaddleValue<EvalT, Traits>::
00017 ResponseSaddleValue(Teuchos::ParameterList& p,
00018 const Teuchos::RCP<Albany::Layouts>& dl) :
00019 coordVec(p.get<std::string>("Coordinate Vector Name"), dl->qp_vector),
00020 coordVec_vertices(p.get<std::string>("Coordinate Vector Name"), dl->vertices_vector),
00021 weights(p.get<std::string>("Weights Name"), dl->qp_scalar)
00022 {
00023 using Teuchos::RCP;
00024
00026 RCP<Teuchos::ParameterList> probList =
00027 p.get< RCP<Teuchos::ParameterList> >("Parameters From Problem");
00028 lattTemp = probList->get<double>("Temperature");
00029 materialDB = probList->get< RCP<QCAD::MaterialDatabase> >("MaterialDB");
00030
00032 Teuchos::ParameterList* plist =
00033 p.get<Teuchos::ParameterList*>("Parameter List");
00034
00035 Teuchos::RCP<const Teuchos::ParameterList> reflist =
00036 this->getValidResponseParameters();
00037 plist->validateParameters(*reflist,0);
00038
00040 svResponseFn = plist->get<Teuchos::RCP<QCAD::SaddleValueResponseFunction> >
00041 ("Response Function");
00042
00044 std::vector<PHX::DataLayout::size_type> dims;
00045 dl->qp_vector->dimensions(dims);
00046 numQPs = dims[1];
00047 numDims = dims[2];
00048 dl->vertices_vector->dimensions(dims);
00049 numVertices = dims[2];
00050
00052 fieldName = plist->get<std::string>("Field Name");
00053
00054
00055
00056
00057 if (fieldName != "Potential")
00058 TEUCHOS_TEST_FOR_EXCEPTION (true, Teuchos::Exceptions::InvalidParameter, std::endl
00059 << "Error! Field Name must be Potential" << std::endl);
00060
00061 fieldGradientName = plist->get<std::string>("Field Gradient Name");
00062 scaling = plist->get<double>("Field Scaling Factor",-1.0);
00063 gradScaling = plist->get<double>("Field Gradient Scaling Factor",-1.0);
00064
00065 retFieldName = plist->get<std::string>("Return Field Name", fieldName);
00066 retScaling = plist->get<double>("Return Field Scaling Factor",1.0);
00067 bReturnSameField = (fieldName == retFieldName);
00068
00069
00071
00072 if(retFieldName == "current")
00073 bReturnSameField = true;
00074
00076 PHX::MDField<ScalarT> f(fieldName, dl->qp_scalar); field = f;
00077 PHX::MDField<ScalarT> fg(fieldGradientName, dl->qp_vector); fieldGradient = fg;
00078
00079 if(!bReturnSameField) {
00080 PHX::MDField<ScalarT> fr(retFieldName, dl->qp_scalar); retField = fr; }
00081
00082
00084 this->addDependentField(field);
00085 this->addDependentField(fieldGradient);
00086 this->addDependentField(coordVec);
00087 this->addDependentField(coordVec_vertices);
00088 this->addDependentField(weights);
00089 if(!bReturnSameField) this->addDependentField(retField);
00090
00091 std::string responseID = "QCAD Saddle Value";
00092 this->setName(responseID + PHX::TypeString<EvalT>::value);
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 p.set("Stand-alone Evaluator", false);
00103
00104 int responseSize = 5;
00105 int worksetSize = dl->qp_scalar->dimension(0);
00106 Teuchos::RCP<PHX::DataLayout> global_response_layout =
00107 Teuchos::rcp(new PHX::MDALayout<Dim>(responseSize));
00108 Teuchos::RCP<PHX::DataLayout> local_response_layout =
00109 Teuchos::rcp(new PHX::MDALayout<Cell,Dim>(worksetSize, responseSize));
00110
00111
00112 std::string local_response_name =
00113 fieldName + " Local Response Saddle Value";
00114 std::string global_response_name =
00115 fieldName + " Global Response Saddle Value";
00116
00117 PHX::Tag<ScalarT> local_response_tag(local_response_name,
00118 local_response_layout);
00119 PHX::Tag<ScalarT> global_response_tag(global_response_name,
00120 global_response_layout);
00121 p.set("Local Response Field Tag", local_response_tag);
00122 p.set("Global Response Field Tag", global_response_tag);
00123 PHAL::SeparableScatterScalarResponse<EvalT,Traits>::setup(p,dl);
00124 }
00125
00126
00127 template<typename EvalT, typename Traits>
00128 void QCAD::ResponseSaddleValue<EvalT, Traits>::
00129 postRegistrationSetup(typename Traits::SetupData d,
00130 PHX::FieldManager<Traits>& fm)
00131 {
00132 this->utils.setFieldData(field,fm);
00133 this->utils.setFieldData(fieldGradient,fm);
00134 this->utils.setFieldData(coordVec,fm);
00135 this->utils.setFieldData(coordVec_vertices,fm);
00136 this->utils.setFieldData(weights,fm);
00137 if(!bReturnSameField) this->utils.setFieldData(retField,fm);
00138 PHAL::SeparableScatterScalarResponse<EvalT,Traits>::postRegistrationSetup(d,fm);
00139 }
00140
00141
00142 template<typename EvalT, typename Traits>
00143 void QCAD::ResponseSaddleValue<EvalT, Traits>::
00144 preEvaluate(typename Traits::PreEvalData workset)
00145 {
00146 for (typename PHX::MDField<ScalarT>::size_type i=0;
00147 i<this->global_response.size(); i++)
00148 this->global_response[i] = 0.0;
00149
00150
00151 PHAL::SeparableScatterScalarResponse<EvalT,Traits>::preEvaluate(workset);
00152 }
00153
00154
00155
00156 template<typename EvalT, typename Traits>
00157 void QCAD::ResponseSaddleValue<EvalT, Traits>::
00158 evaluateFields(typename Traits::EvalData workset)
00159 {
00160
00161 for (typename PHX::MDField<ScalarT>::size_type i=0;
00162 i<this->local_response.size(); i++)
00163 this->local_response[i] = 0.0;
00164
00165 const int MAX_DIMS = 3;
00166 ScalarT fieldVal, retFieldVal, cellVol, cellArea;
00167 std::vector<ScalarT> fieldGrad(numDims, 0.0);
00168 double dblAvgCoords[MAX_DIMS], dblFieldGrad[MAX_DIMS], dblFieldVal, dblCellArea, dblMaxZ;
00169
00170 if(svResponseFn->getMode() == "Point location") {
00171 for (std::size_t cell=0; cell < workset.numCells; ++cell) {
00172
00173 getAvgCellCoordinates(coordVec, cell, dblAvgCoords, dblMaxZ);
00174 getCellQuantities(cell, cellVol, fieldVal, retFieldVal, fieldGrad);
00175 dblFieldVal = QCAD::EvaluatorTools<EvalT,Traits>::getDoubleValue(fieldVal);
00176 svResponseFn->addBeginPointData(workset.EBName, dblAvgCoords, dblFieldVal);
00177 svResponseFn->addEndPointData(workset.EBName, dblAvgCoords, dblFieldVal);
00178 }
00179 }
00180 else if(svResponseFn->getMode() == "Collect image point data") {
00181 for (std::size_t cell=0; cell < workset.numCells; ++cell) {
00182 getAvgCellCoordinates(coordVec, cell, dblAvgCoords, dblMaxZ);
00183
00184 if(svResponseFn->pointIsInImagePtRegion(dblAvgCoords, dblMaxZ)) {
00185 getCellQuantities(cell, cellVol, fieldVal, retFieldVal, fieldGrad);
00186
00187 dblFieldVal = QCAD::EvaluatorTools<EvalT,Traits>::getDoubleValue(fieldVal);
00188 for (std::size_t k=0; k < numDims; ++k)
00189 dblFieldGrad[k] = QCAD::EvaluatorTools<EvalT,Traits>::getDoubleValue(fieldGrad[k]);
00190
00191 svResponseFn->addImagePointData(dblAvgCoords, dblFieldVal, dblFieldGrad);
00192 }
00193 }
00194 }
00195 else if(svResponseFn->getMode() == "Collect final image point data") {
00196 for (std::size_t cell=0; cell < workset.numCells; ++cell) {
00197 getAvgCellCoordinates(coordVec, cell, dblAvgCoords, dblMaxZ);
00198
00199 if(svResponseFn->pointIsInImagePtRegion(dblAvgCoords, dblMaxZ)) {
00200 getCellQuantities(cell, cellVol, fieldVal, retFieldVal, fieldGrad);
00201
00202 dblFieldVal = QCAD::EvaluatorTools<EvalT,Traits>::getDoubleValue(fieldVal);
00203 svResponseFn->addFinalImagePointData(dblAvgCoords, dblFieldVal);
00204 }
00205 }
00206 }
00207 else if(svResponseFn->getMode() == "Accumulate all field data") {
00208 for (std::size_t cell=0; cell < workset.numCells; ++cell) {
00209 getAvgCellCoordinates(coordVec, cell, dblAvgCoords, dblMaxZ);
00210
00211 if(svResponseFn->pointIsInAccumRegion(dblAvgCoords, dblMaxZ)) {
00212 getCellQuantities(cell, cellVol, fieldVal, retFieldVal, fieldGrad);
00213
00214 dblFieldVal = QCAD::EvaluatorTools<EvalT,Traits>::getDoubleValue(fieldVal);
00215 for (std::size_t k=0; k < numDims; ++k)
00216 dblFieldGrad[k] = QCAD::EvaluatorTools<EvalT,Traits>::getDoubleValue(fieldGrad[k]);
00217 svResponseFn->accumulatePointData(dblAvgCoords, dblFieldVal, dblFieldGrad);
00218 }
00219 }
00220 }
00221 else if(svResponseFn->getMode() == "Fill saddle point") {
00222 double wt;
00223 double totalWt = svResponseFn->getTotalSaddlePointWeight();
00224
00225 for (std::size_t cell=0; cell < workset.numCells; ++cell) {
00226 getAvgCellCoordinates(coordVec, cell, dblAvgCoords, dblMaxZ);
00227
00228 if(svResponseFn->pointIsInImagePtRegion(dblAvgCoords, dblMaxZ)) {
00229
00230 if( (wt = svResponseFn->getSaddlePointWeight(dblAvgCoords)) > 0.0) {
00231 getCellQuantities(cell, cellVol, fieldVal, retFieldVal, fieldGrad);
00232 wt /= totalWt;
00233
00234
00235 this->local_response(cell,0) += wt*retFieldVal;
00236 this->global_response[0] += wt*retFieldVal;
00237
00238
00239 this->local_response(cell,1) += wt*fieldVal;
00240 this->global_response[1] += wt*fieldVal;
00241
00242 this->global_response[2] = 0.0;
00243 this->global_response[3] = 0.0;
00244 this->global_response[4] = 0.0;
00245 }
00246 }
00247 }
00248 }
00249 else if(svResponseFn->getMode() == "Level set data collection") {
00250 for (std::size_t cell=0; cell < workset.numCells; ++cell) {
00251 getAvgCellCoordinates(coordVec, cell, dblAvgCoords, dblMaxZ);
00252
00253 if(svResponseFn->pointIsInLevelSetRegion(dblAvgCoords,dblMaxZ)) {
00254 getCellQuantities(cell, cellVol, fieldVal, retFieldVal, fieldGrad);
00255 getCellArea(cell, cellArea);
00256
00257 dblFieldVal = QCAD::EvaluatorTools<EvalT,Traits>::getDoubleValue(fieldVal);
00258 dblCellArea = QCAD::EvaluatorTools<EvalT,Traits>::getDoubleValue(cellVol);
00259 for (std::size_t k=0; k < numDims; ++k)
00260 dblFieldGrad[k] = QCAD::EvaluatorTools<EvalT,Traits>::getDoubleValue(fieldGrad[k]);
00261 svResponseFn->accumulateLevelSetData(dblAvgCoords, dblFieldVal, dblCellArea);
00262 }
00263 }
00264 }
00265 else TEUCHOS_TEST_FOR_EXCEPTION (true, Teuchos::Exceptions::InvalidParameter, std::endl
00266 << "Error! Invalid mode: " << svResponseFn->getMode() << std::endl);
00267
00268
00269 PHAL::SeparableScatterScalarResponse<EvalT,Traits>::evaluateFields(workset);
00270 }
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294 template<typename EvalT, typename Traits>
00295 void QCAD::ResponseSaddleValue<EvalT, Traits>::
00296 postEvaluate(typename Traits::PostEvalData workset)
00297 {
00298
00299 if(svResponseFn->getMode() == "Fill saddle point") {
00300
00301
00302 Teuchos::RCP< Teuchos::ValueTypeSerializer<int,ScalarT> > serializer =
00303 workset.serializerManager.template getValue<EvalT>();
00304 Teuchos::reduceAll(
00305 *workset.comm, *serializer, Teuchos::REDUCE_SUM,
00306 this->global_response.size(), &this->global_response[0],
00307 &this->global_response[0]);
00308
00309
00310 const double* pt = svResponseFn->getSaddlePointPosition();
00311 for(std::size_t i=0; i<numDims; i++)
00312 this->global_response[2+i] = pt[i];
00313
00314 if(retFieldName == "current" &&
00315
00316
00317 (QCAD::EvaluatorTools<EvalT,Traits>::getEvalType() == "Residual") )
00318 {
00319
00320
00321
00322
00323
00324 this->global_response[1] = this->global_response[0];
00325 this->global_response[0] = svResponseFn->getCurrent(lattTemp, materialDB);
00326 }
00327
00328
00329 PHAL::SeparableScatterScalarResponse<EvalT,Traits>::postEvaluate(workset);
00330 }
00331 }
00332
00333
00334
00335 template<typename EvalT,typename Traits>
00336 Teuchos::RCP<const Teuchos::ParameterList>
00337 QCAD::ResponseSaddleValue<EvalT,Traits>::getValidResponseParameters() const
00338 {
00339 Teuchos::RCP<Teuchos::ParameterList> validPL =
00340 rcp(new Teuchos::ParameterList("Valid ResponseSaddleValue Params"));
00341 Teuchos::RCP<const Teuchos::ParameterList> baseValidPL =
00342 PHAL::SeparableScatterScalarResponse<EvalT,Traits>::getValidResponseParameters();
00343 validPL->setParameters(*baseValidPL);
00344
00345 validPL->set<std::string>("Name", "", "Name of response function");
00346 validPL->set<int>("Phalanx Graph Visualization Detail", 0, "Make dot file to visualize phalanx graph");
00347 validPL->set<std::string>("Field Name", "", "Scalar field on which to find saddle point");
00348 validPL->set<std::string>("Field Gradient Name", "", "Gradient of field on which to find saddle point");
00349 validPL->set<std::string>("Return Field Name", "<field name>", "Scalar field to return value from");
00350 validPL->set<double>("Field Scaling Factor", 1.0, "Scaling factor for field on which to find saddle point");
00351 validPL->set<double>("Field Gradient Scaling Factor", 1.0, "Scaling factor for field gradient");
00352 validPL->set<double>("Return Field Scaling Factor", 1.0, "Scaling factor for return field");
00353
00354 validPL->set<int>("Number of Image Points", 10, "Number of image points to use, including the two endpoints");
00355 validPL->set<double>("Image Point Size", 1.0, "Size of image points, modeled as gaussian weight distribution");
00356 validPL->set<int>("Maximum Iterations", 100, "Maximum number of NEB iterations");
00357 validPL->set<int>("Backtrace After Iteration", 10000000, "Backtrace, i.e., don't let grad(highest pt) increase, after this iteration");
00358 validPL->set<double>("Max Time Step", 1.0, "Maximum (and initial) time step");
00359 validPL->set<double>("Min Time Step", 0.002, "Minimum time step");
00360 validPL->set<double>("Convergence Tolerance", 1e-5, "Convergence criterion when |grad| of saddle is below this number");
00361 validPL->set<double>("Min Spring Constant", 1.0, "Minimum spring constant used between image points (initial time)");
00362 validPL->set<double>("Max Spring Constant", 1.0, "Maximum spring constant used between image points (final time)");
00363 validPL->set<std::string>("Output Filename", "", "Filename to receive elastic band points and values at given interval");
00364 validPL->set<int>("Output Interval", 0, "Output elastic band points every <output interval> iterations");
00365 validPL->set<std::string>("Debug Filename", "", "Filename for algorithm debug info");
00366 validPL->set<bool>("Append Output", false, "If true, output is appended to Output Filename (if it exists)");
00367 validPL->set<bool>("Climbing NEB", true, "Whether or not to use the climbing NEB algorithm");
00368 validPL->set<double>("Anti-Kink Factor", 0.0, "Factor between 0 and 1 giving about of perpendicular spring force to inclue");
00369 validPL->set<bool>("Aggregate Worksets", false, "Whether or not to store off a proc's worksets locally. Increased speed but requires more memory");
00370 validPL->set<bool>("Adaptive Image Point Size", false, "Whether or not image point sizes should adapt to local mesh density");
00371 validPL->set<double>("Adaptive Min Point Weight", 0.5, "Minimum desirable point weight when adaptively choosing image point sizes");
00372 validPL->set<double>("Adaptive Max Point Weight", 5.0, "Maximum desirable point weight when adaptively choosing image point sizes");
00373
00374 validPL->set<double>("Levelset Field Cutoff Factor", 1.0, "Fraction of field range to use as cutoff in level set algorithm");
00375 validPL->set<double>("Levelset Minimum Pool Depth Factor", 1.0, "Fraction of automatic value to use as minimum pool depth level set algorithm");
00376 validPL->set<double>("Levelset Distance Cutoff Factor", 1.0, "Fraction of avg cell length to use as cutoff in level set algorithm");
00377 validPL->set<double>("Levelset Radius", 0.0, "Radius around image point to use as level-set domain (zero == don't use level set");
00378
00379 validPL->set<double>("z min", 0.0, "Domain minimum z coordinate");
00380 validPL->set<double>("z max", 0.0, "Domain maximum z coordinate");
00381 validPL->set<double>("Lock to z-coord", 0.0, "z-coordinate to lock elastic band to, making a 3D problem into 2D");
00382
00383 validPL->set<int>("Maximum Number of Final Points", 0, "Maximum number of final points to use. Zero indicates no final points are used and data is just returned at image points.");
00384
00385 validPL->set<Teuchos::Array<double> >("Begin Point", Teuchos::Array<double>(), "Beginning point of elastic band");
00386 validPL->set<std::string>("Begin Element Block", "", "Element block name whose minimum marks the elastic band's beginning");
00387 validPL->sublist("Begin Polygon", false, "Beginning polygon sublist");
00388
00389 validPL->set<Teuchos::Array<double> >("End Point", Teuchos::Array<double>(), "Ending point of elastic band");
00390 validPL->set<std::string>("End Element Block", "", "Element block name whose minimum marks the elastic band's ending");
00391 validPL->sublist("End Polygon", false, "Ending polygon sublist");
00392
00393 validPL->set<double>("Percent to Shorten Begin", 0.0, "Percentage of total or half path (if guessed pt) to shorten the beginning of the path");
00394 validPL->set<double>("Percent to Shorten End", 0.0, "Percentage of total or half path (if guessed pt) to shorten the end of the path");
00395
00396 validPL->set<Teuchos::Array<double> >("Saddle Point Guess", Teuchos::Array<double>(), "Estimate of where the saddle point lies");
00397
00398 validPL->set<double>("GF-CBR Method Energy Cutoff Offset", 0, "Value [in eV] added to the maximum energy integrated over in Green's Function - Contact Block Reduction method for obtaining current to obtain the cutoff energy, which sets the largest eigenvalue needed in the tight binding diagonalization part of the method");
00399 validPL->set<double>("GF-CBR Method Grid Spacing", 0.0005, "Uniform 1D grid spacing for GF-CBR current calculation - given in mesh units");
00400
00401 validPL->set<bool>("GF-CBR Method Vds Sweep", false, "Specify if want to sweep a range of Vds values or just want one Vds");
00402 validPL->set<double>("GF-CBR Method Vds Initial Value", 0., "Initial Vds value [V] when sweeping Vds is true");
00403 validPL->set<double>("GF-CBR Method Vds Final Value", 0., "Final Vds value [V]");
00404 validPL->set<int>("GF-CBR Method Vds Steps", 10, "Number of Vds steps going from initial to final values");
00405 validPL->set<std::string>("GF-CBR Method Eigensolver", "", "Eigensolver used by the GF-CBR method");
00406
00407 validPL->set<int>("Debug Mode", 0, "Print verbose debug messages to stdout");
00408 validPL->set< Teuchos::RCP<QCAD::SaddleValueResponseFunction> >("Response Function", Teuchos::null, "Saddle value response function");
00409
00410 validPL->set<std::string>("Description", "", "Description of this response used by post processors");
00411
00412 return validPL;
00413 }
00414
00415
00416 template<typename EvalT, typename Traits>
00417 void QCAD::ResponseSaddleValue<EvalT, Traits>::
00418 getCellQuantities(const std::size_t cell, typename EvalT::ScalarT& cellVol, typename EvalT::ScalarT& fieldVal,
00419 typename EvalT::ScalarT& retFieldVal, std::vector<typename EvalT::ScalarT>& fieldGrad) const
00420 {
00421 cellVol = 0.0;
00422 fieldVal = 0.0;
00423 retFieldVal = 0.0;
00424 for (std::size_t k=0; k < numDims; ++k) fieldGrad[k] = 0.0;
00425
00426
00427 for (std::size_t qp=0; qp < numQPs; ++qp)
00428 cellVol += weights(cell,qp);
00429
00430
00431 for (std::size_t qp=0; qp < numQPs; ++qp)
00432 fieldVal += field(cell,qp) * weights(cell,qp);
00433 fieldVal *= scaling / cellVol;
00434
00435
00436 if(bReturnSameField) {
00437 retFieldVal = retScaling * fieldVal;
00438 }
00439 else {
00440 for (std::size_t qp=0; qp < numQPs; ++qp)
00441 retFieldVal += retField(cell,qp) * weights(cell,qp);
00442 retFieldVal *= retScaling / cellVol;
00443 }
00444
00445
00446 for (std::size_t qp=0; qp < numQPs; ++qp) {
00447 for (std::size_t k=0; k < numDims; ++k)
00448 fieldGrad[k] += fieldGradient(cell,qp,k) * weights(cell,qp);
00449 }
00450 for (std::size_t k=0; k < numDims; ++k) fieldGrad[k] *= gradScaling / cellVol;
00451
00452 return;
00453 }
00454
00455 template<typename EvalT, typename Traits>
00456 void QCAD::ResponseSaddleValue<EvalT, Traits>::
00457 getCellArea(const std::size_t cell, typename EvalT::ScalarT& cellArea) const
00458 {
00459 std::vector<ScalarT> maxCoord(3,-1e10);
00460 std::vector<ScalarT> minCoord(3,+1e10);
00461
00462 for (std::size_t v=0; v < numVertices; ++v) {
00463 for (std::size_t k=0; k < numDims; ++k) {
00464 if(maxCoord[k] < coordVec_vertices(cell,v,k)) maxCoord[k] = coordVec_vertices(cell,v,k);
00465 if(minCoord[k] > coordVec_vertices(cell,v,k)) minCoord[k] = coordVec_vertices(cell,v,k);
00466 }
00467 }
00468
00469 cellArea = 1.0;
00470 for (std::size_t k=0; k < numDims && k < 2; ++k)
00471 cellArea *= (maxCoord[k] - minCoord[k]);
00472 }
00473
00474
00475
00476
00477 template<typename EvalT, typename Traits>
00478 void QCAD::ResponseSaddleValue<EvalT, Traits>::
00479 getAvgCellCoordinates(PHX::MDField<typename EvalT::MeshScalarT,Cell,QuadPoint,Dim> coordVec,
00480 const std::size_t cell, double* dblAvgCoords, double& dblMaxZ) const
00481 {
00482 std::vector<MeshScalarT> avgCoord(numDims, 0.0);
00483
00484
00485
00486 for (std::size_t k=0; k < numDims; ++k) avgCoord[k] = 0.0;
00487 for (std::size_t qp=0; qp < numQPs; ++qp) {
00488 for (std::size_t k=0; k < numDims; ++k)
00489 avgCoord[k] += coordVec(cell,qp,k);
00490 }
00491 for (std::size_t k=0; k < numDims; ++k) {
00492 avgCoord[k] /= numQPs;
00493 dblAvgCoords[k] = QCAD::EvaluatorTools<EvalT,Traits>::getDoubleValue(avgCoord[k]);
00494 }
00495
00496
00497 if(numDims > 2) {
00498 MeshScalarT maxZ = -1e10;
00499 for (std::size_t v=0; v < numVertices; ++v) {
00500 if(maxZ < coordVec_vertices(cell,v,2)) maxZ = coordVec_vertices(cell,v,2);
00501 }
00502 dblMaxZ = QCAD::EvaluatorTools<EvalT,Traits>::getDoubleValue(maxZ);
00503 }
00504 else dblMaxZ = 0.0;
00505
00506 }