Go to the documentation of this file.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
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include "SundanceStdFwkEvalMediator.hpp"
00043 #include "SundanceCoordExpr.hpp"
00044 #include "SundanceOut.hpp"
00045 #include "PlayaTabs.hpp"
00046 #include "PlayaExceptions.hpp"
00047
00048
00049 using namespace Sundance;
00050 using namespace Sundance;
00051 using namespace Sundance;
00052 using namespace Sundance;
00053 using namespace Sundance;
00054 using namespace Sundance;
00055 using namespace Sundance;
00056 using namespace Teuchos;
00057
00058
00059
00060
00061
00062 StdFwkEvalMediator::StdFwkEvalMediator(const Mesh& mesh, int cellDim)
00063 : AbstractEvalMediator(),
00064 mesh_(mesh),
00065 cellDim_(cellDim),
00066 cellType_(NullCell),
00067 maxCellType_(NullCell),
00068 isInternalBdry_(false),
00069 forbidCofacetIntegrations_(false),
00070 cellLID_(),
00071 JVol_(rcp(new CellJacobianBatch())),
00072 JTrans_(rcp(new CellJacobianBatch())),
00073 facetIndices_(rcp(new Array<int>())),
00074 maxCellLIDs_(rcp(new Array<int>())),
00075 cofacetCellsAreReady_(false),
00076 cacheIsValid_(false),
00077 jCacheIsValid_(false),
00078 fCache_(),
00079 dfCache_(),
00080 localValueCache_(),
00081 mapStructCache_(),
00082 fCacheIsValid_(),
00083 dfCacheIsValid_(),
00084 localValueCacheIsValid_()
00085 {;}
00086
00087 void StdFwkEvalMediator::setCellType(const CellType& cellType,
00088 const CellType& maxCellType,
00089 bool isInternalBdry)
00090 {
00091 cellType_=cellType;
00092 cellDim_ = dimension(cellType);
00093 maxCellType_ = maxCellType;
00094 isInternalBdry_ = isInternalBdry;
00095 cacheIsValid() = false;
00096 jCacheIsValid_=false;
00097 cofacetCellsAreReady_ = false;
00098 forbidCofacetIntegrations_ = isInternalBdry_ ;
00099
00100 }
00101
00102
00103 void StdFwkEvalMediator::setIntegrationSpec(
00104 IntegrationCellSpecifier intCellSpec)
00105 {
00106 intCellSpec_ = intCellSpec;
00107 }
00108
00109 void StdFwkEvalMediator::setCellBatch(
00110 const RCP<const Array<int> >& cellLID)
00111 {
00112 Tabs tab(0);
00113 SUNDANCE_MSG1(verb(), tab << "eval med setting cell batch");
00114 Tabs tab1;
00115
00116 cellLID_ = cellLID;
00117 cacheIsValid() = false;
00118 jCacheIsValid_=false;
00119 cofacetCellsAreReady_ = false;
00120
00121 SUNDANCE_MSG2(verb(), tab1 << "getting volume Jacobians");
00122 mesh_.getJacobians(cellDim(), *cellLID, *JVol_);
00123 if (intCellSpec_!=NoTermsNeedCofacets) setupFacetTransformations();
00124
00125
00126 SUNDANCE_MSG2(verb(), tab1 << "flushing old function caches");
00127 Map<const DiscreteFunctionData*, bool>::iterator iter;
00128 for (iter = fCacheIsValid_.begin(); iter != fCacheIsValid_.end(); iter++)
00129 {
00130 iter->second = false;
00131 }
00132 for (iter = dfCacheIsValid_.begin(); iter != dfCacheIsValid_.end(); iter++)
00133 {
00134 iter->second = false;
00135 }
00136 for (iter = localValueCacheIsValid_.begin(); iter != localValueCacheIsValid_.end(); iter++)
00137 {
00138 iter->second = false;
00139 }
00140 }
00141
00142 void StdFwkEvalMediator::setupFacetTransformations() const
00143 {
00144 Tabs tab(0);
00145 SUNDANCE_MSG1(verb(), tab << "setting up facet transformations");
00146 Tabs tab1;
00147
00148 const Array<int>& cells = *cellLID_;
00149
00150 SUNDANCE_MSG2(verb(), tab1 << "num cells in batch = " << cells.size());
00151 SUNDANCE_MSG2(verb(), tab1 << "cell dim = " << cellDim());
00152 SUNDANCE_MSG2(verb(), tab1 << "num d-cells in mesh = " << mesh_.numCells(cellDim()));
00153
00154
00155 facetIndices_->resize(cells.size());
00156 maxCellLIDs_->resize(cells.size());
00157 cofacetCellsAreReady_ = true;
00158
00159 for (int c=0; c<cells.size(); c++)
00160 {
00161 Tabs tab2;
00162 SUNDANCE_MSG2(verb(), tab2 << "c = " << c);
00163 SUNDANCE_MSG2(verb(), tab2 << "cells[c] = " << cells[c]);
00164 (*maxCellLIDs_)[c]
00165 = mesh_.maxCofacetLID(cellDim(), cells[c], 0, (*facetIndices_)[c]);
00166 }
00167
00168 SUNDANCE_MSG2(verb(), tab1 << "getting facet Jacobians");
00169 mesh_.getJacobians(mesh_.spatialDim(), *maxCellLIDs_, *JTrans_);
00170 SUNDANCE_MSG2(verb(), tab << "setting up facet transformations");
00171 }
00172
00173
00174
00175 const CellJacobianBatch& StdFwkEvalMediator::JTrans() const
00176 {
00177
00178
00179
00180 if (intCellSpec_ != NoTermsNeedCofacets)
00181 {
00182 return *JTrans_;
00183 }
00184 else
00185 {
00186 return *JVol_;
00187 }
00188 }