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 "SundanceOut.hpp"
00043 #include "PlayaTabs.hpp"
00044 #include "SundanceMapBundle.hpp"
00045 #include "SundanceDOFMapBase.hpp"
00046 #include "SundanceStdFwkEvalMediator.hpp"
00047
00048 using namespace Sundance;
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 Teuchos;
00056
00057
00058
00059 MapBundle::MapBundle(
00060 const Array<RCP<DOFMapBase> >& dofMap,
00061 const Array<RCP<Array<int> > >& isBCIndex,
00062 const Array<int>& lowestLocalIndex,
00063 bool partitionBCs,
00064 int verb
00065 )
00066 : verb_(verb),
00067 dofMap_(dofMap),
00068 isBCIndex_(isBCIndex),
00069 lowestLocalIndex_(lowestLocalIndex),
00070 localDOFMap_(rcp(new LocalDOFMap(dofMap_.size(), verb))),
00071 cofacetLocalDOFMap_(rcp(new LocalDOFMap(dofMap_.size(), verb)))
00072 {}
00073
00074 int MapBundle::nCells() const
00075 {
00076 TEUCHOS_TEST_FOR_EXCEPTION(localDOFMap_->isUnused()
00077 && cofacetLocalDOFMap_->isUnused(), std::runtime_error,
00078 "no local DOF maps defined in call to MapBundle::nCells()");
00079
00080
00081 if (cofacetLocalDOFMap_->isUnused())
00082 {
00083 return localDOFMap_->nCells();
00084 }
00085 else if (localDOFMap_->isUnused())
00086 {
00087 return cofacetLocalDOFMap_->nCells();
00088 }
00089 else
00090 {
00091 TEUCHOS_TEST_FOR_EXCEPTION(localDOFMap_->nCells() != cofacetLocalDOFMap_->nCells(),
00092 std::runtime_error,
00093 "mismatched cell counts in MapBundle::nCells()");
00094 return cofacetLocalDOFMap_->nCells();
00095 }
00096 }
00097
00098 RCP<const Array<int> > MapBundle::workSet(int block,
00099 bool useCofacets) const
00100 {
00101 return chooseMap(block, useCofacets)->cellLIDs();
00102 }
00103
00104
00105 const RCP<LocalDOFMap>& MapBundle::chooseMap(
00106 int block, bool useCofacets) const
00107 {
00108 if (useCofacets)
00109 {
00110 TEUCHOS_TEST_FOR_EXCEPTION(cofacetLocalDOFMap_->isUnused(block),
00111 std::runtime_error,
00112 "request for unavailable cofacet-based local map for block = " << block);
00113 return cofacetLocalDOFMap_;
00114 }
00115 else
00116 {
00117 TEUCHOS_TEST_FOR_EXCEPTION(localDOFMap_->isUnused(block),
00118 std::runtime_error,
00119 "request for unavailable local map for block = " << block);
00120 return localDOFMap_;
00121 }
00122 }
00123
00124
00125
00126
00127 void MapBundle::buildLocalDOFMaps(
00128 const RCP<StdFwkEvalMediator>& mediator,
00129 IntegrationCellSpecifier intCellSpec,
00130 const Array<Set<int> >& requiredFuncs,
00131 int verbosity)
00132 {
00133 Tabs tab;
00134
00135 int numBlocks = dofMap_.size();
00136
00137 localDOFMap_->markAsUnused();
00138 cofacetLocalDOFMap_->markAsUnused();
00139 localDOFMap_->setVerb(verbosity);
00140 cofacetLocalDOFMap_->setVerb(verbosity);
00141
00142 int maxCellDim = mediator->maxCellDim();
00143 int cellDim = mediator->cellDim();
00144
00145 SUNDANCE_MSG3(verbosity, tab << "cell dim=" << cellDim);
00146 SUNDANCE_MSG3(verbosity, tab << "max cell dim=" << maxCellDim);
00147
00148 for (int b=0; b<numBlocks; b++)
00149 {
00150 Tabs tab2;
00151 SUNDANCE_MSG3(verbosity, tab2 << "getting dofs for block "
00152 << b << " of " << numBlocks);
00153
00154 if (intCellSpec != AllTermsNeedCofacets)
00155 {
00156 Tabs tab3;
00157 SUNDANCE_MSG3(verbosity, tab3 << "getting ordinary dofs");
00158
00159 if (!localDOFMap_->hasCells())
00160 {
00161 SUNDANCE_MSG3(verbosity, tab3 << "setting cells of dim "
00162 << cellDim);
00163 localDOFMap_->setCells(cellDim, maxCellDim, mediator->cellLID());
00164 }
00165 localDOFMap_->fillBlock(b, dofMap_[b], requiredFuncs);
00166 localDOFMap_->markAsUsed(b);
00167 }
00168 else
00169 {
00170 Tabs tab3;
00171 SUNDANCE_MSG3(verbosity, tab3 << "ordinary dofs not needed for block " << b);
00172 }
00173
00174
00175 if (intCellSpec != NoTermsNeedCofacets)
00176 {
00177 Tabs tab3;
00178 SUNDANCE_MSG3(verbosity, tab3 << "getting cofacet dofs");
00179 SUNDANCE_MSG3(verbosity, tab3 << "cofacet cells="
00180 << *(mediator->cofacetCellLID()));
00181
00182 if (!cofacetLocalDOFMap_->hasCells())
00183 cofacetLocalDOFMap_->setCells(maxCellDim,
00184 maxCellDim, mediator->cofacetCellLID());
00185
00186 cofacetLocalDOFMap_->fillBlock(b, dofMap_[b], requiredFuncs);
00187 cofacetLocalDOFMap_->markAsUsed(b);
00188 }
00189 else
00190 {
00191 Tabs tab3;
00192 SUNDANCE_MSG3(verbosity, tab3 << "cofacet dofs not needed for block " << b);
00193 }
00194
00195 }
00196
00197 if (intCellSpec != AllTermsNeedCofacets)
00198 {
00199 SUNDANCE_MSG4(verbosity, tab << "local DOF values " << *localDOFMap_);
00200 }
00201
00202 if (intCellSpec != NoTermsNeedCofacets)
00203 {
00204 SUNDANCE_MSG4(verbosity, tab << "local cofacet DOF values "
00205 << *cofacetLocalDOFMap_);
00206 }
00207 }