| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// ShyLU: Scalable Hybrid LU Preconditioner and Solver |
| 4 |
// |
| 5 |
// Copyright 2011 NTESS and the ShyLU contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
#ifndef _FROSCH_GDSWCOARSEOPERATOR_DEF_HPP |
| 11 |
#define _FROSCH_GDSWCOARSEOPERATOR_DEF_HPP |
| 12 |
|
| 13 |
#include <FROSch_GDSWCoarseOperator_decl.hpp> |
| 14 |
|
| 15 |
|
| 16 |
namespace FROSch { |
| 17 |
|
| 18 |
using namespace Teuchos; |
| 19 |
using namespace Xpetra; |
| 20 |
|
| 21 |
template <class SC,class LO,class GO,class NO> |
| 22 |
GDSWCoarseOperator<SC,LO,GO,NO>::GDSWCoarseOperator(ConstXMatrixPtr k, |
| 23 |
ParameterListPtr parameterList) : |
| 24 |
HarmonicCoarseOperator<SC,LO,GO,NO> (k,parameterList) |
| 25 |
{ |
| 26 |
FROSCH_DETAILTIMER_START_LEVELID(gDSWCoarseOperatorTime,"GDSWCoarseOperator::GDSWCoarseOperator"); |
| 27 |
} |
| 28 |
|
| 29 |
template <class SC,class LO,class GO,class NO> |
| 30 |
int GDSWCoarseOperator<SC,LO,GO,NO>::initialize(UN dimension, |
| 31 |
ConstXMapPtr repeatedMap) |
| 32 |
{ |
| 33 |
FROSCH_TIMER_START_LEVELID(initializeTime,"GDSWCoarseOperator::initialize"); |
| 34 |
buildCoarseSpace(dimension,repeatedMap); |
| 35 |
this->assembleInterfaceCoarseSpace(); |
| 36 |
this->buildCoarseSolveMap(this->AssembledInterfaceCoarseSpace_->getBasisMapUnique()); |
| 37 |
this->IsInitialized_ = true; |
| 38 |
this->IsComputed_ = false; |
| 39 |
return 0; |
| 40 |
} |
| 41 |
|
| 42 |
template <class SC,class LO,class GO,class NO> |
| 43 |
int GDSWCoarseOperator<SC,LO,GO,NO>::initialize(UN dimension, |
| 44 |
ConstXMapPtr repeatedMap, |
| 45 |
GOVecPtr dirichletBoundaryDofs) |
| 46 |
{ |
| 47 |
FROSCH_TIMER_START_LEVELID(initializeTime,"GDSWCoarseOperator::initialize"); |
| 48 |
buildCoarseSpace(dimension,repeatedMap,dirichletBoundaryDofs); |
| 49 |
this->assembleInterfaceCoarseSpace(); |
| 50 |
this->buildCoarseSolveMap(this->AssembledInterfaceCoarseSpace_->getBasisMapUnique()); |
| 51 |
this->IsInitialized_ = true; |
| 52 |
this->IsComputed_ = false; |
| 53 |
return 0; |
| 54 |
} |
| 55 |
|
| 56 |
template <class SC,class LO,class GO,class NO> |
| 57 |
int GDSWCoarseOperator<SC,LO,GO,NO>::initialize(UN dimension, |
| 58 |
UN dofsPerNode, |
| 59 |
ConstXMapPtr repeatedNodesMap, |
| 60 |
ConstXMapPtrVecPtr repeatedDofMaps) |
| 61 |
{ |
| 62 |
FROSCH_TIMER_START_LEVELID(initializeTime,"GDSWCoarseOperator::initialize"); |
| 63 |
buildCoarseSpace(dimension,dofsPerNode,repeatedNodesMap,repeatedDofMaps); |
| 64 |
this->assembleInterfaceCoarseSpace(); |
| 65 |
this->buildCoarseSolveMap(this->AssembledInterfaceCoarseSpace_->getBasisMapUnique()); |
| 66 |
this->IsInitialized_ = true; |
| 67 |
this->IsComputed_ = false; |
| 68 |
return 0; |
| 69 |
} |
| 70 |
|
| 71 |
template <class SC,class LO,class GO,class NO> |
| 72 |
int GDSWCoarseOperator<SC,LO,GO,NO>::initialize(UN dimension, |
| 73 |
UN dofsPerNode, |
| 74 |
ConstXMapPtr repeatedNodesMap, |
| 75 |
ConstXMapPtrVecPtr repeatedDofMaps, |
| 76 |
GOVecPtr dirichletBoundaryDofs) |
| 77 |
{ |
| 78 |
FROSCH_TIMER_START_LEVELID(initializeTime,"GDSWCoarseOperator::initialize"); |
| 79 |
buildCoarseSpace(dimension,dofsPerNode,repeatedNodesMap,repeatedDofMaps,dirichletBoundaryDofs); |
| 80 |
this->assembleInterfaceCoarseSpace(); |
| 81 |
this->buildCoarseSolveMap(this->AssembledInterfaceCoarseSpace_->getBasisMapUnique()); |
| 82 |
this->IsInitialized_ = true; |
| 83 |
this->IsComputed_ = false; |
| 84 |
return 0; |
| 85 |
} |
| 86 |
|
| 87 |
template <class SC,class LO,class GO,class NO> |
| 88 |
int GDSWCoarseOperator<SC,LO,GO,NO>::initialize(UN dimension, |
| 89 |
UN dofsPerNode, |
| 90 |
ConstXMapPtr repeatedNodesMap, |
| 91 |
ConstXMapPtrVecPtr repeatedDofMaps, |
| 92 |
ConstXMultiVectorPtr nodeList) |
| 93 |
{ |
| 94 |
FROSCH_TIMER_START_LEVELID(initializeTime,"GDSWCoarseOperator::initialize"); |
| 95 |
buildCoarseSpace(dimension,dofsPerNode,repeatedNodesMap,repeatedDofMaps,nodeList); |
| 96 |
this->assembleInterfaceCoarseSpace(); |
| 97 |
this->buildCoarseSolveMap(this->AssembledInterfaceCoarseSpace_->getBasisMapUnique()); |
| 98 |
this->extractLocalSubdomainMatrix_Symbolic(); |
| 99 |
this->IsInitialized_ = true; |
| 100 |
this->IsComputed_ = false; |
| 101 |
return 0; |
| 102 |
} |
| 103 |
|
| 104 |
template <class SC,class LO,class GO,class NO> |
| 105 |
int GDSWCoarseOperator<SC,LO,GO,NO>::initialize(UN dimension, |
| 106 |
UN dofsPerNode, |
| 107 |
ConstXMapPtr repeatedNodesMap, |
| 108 |
ConstXMapPtrVecPtr repeatedDofMaps, |
| 109 |
GOVecPtr dirichletBoundaryDofs, |
| 110 |
ConstXMultiVectorPtr nodeList) |
| 111 |
{ |
| 112 |
FROSCH_TIMER_START_LEVELID(initializeTime,"GDSWCoarseOperator::initialize"); |
| 113 |
buildCoarseSpace(dimension,dofsPerNode,repeatedNodesMap,repeatedDofMaps,dirichletBoundaryDofs,nodeList); |
| 114 |
this->assembleInterfaceCoarseSpace(); |
| 115 |
this->buildCoarseSolveMap(this->AssembledInterfaceCoarseSpace_->getBasisMapUnique()); |
| 116 |
this->IsInitialized_ = true; |
| 117 |
this->IsComputed_ = false; |
| 118 |
return 0; |
| 119 |
} |
| 120 |
|
| 121 |
template <class SC,class LO,class GO,class NO> |
| 122 |
int GDSWCoarseOperator<SC,LO,GO,NO>::initialize(UN dimension, |
| 123 |
UNVecPtr dofsPerNodeVec, |
| 124 |
ConstXMapPtrVecPtr repeatedNodesMapVec, |
| 125 |
ConstXMapPtrVecPtr2D repeatedDofMapsVec, |
| 126 |
GOVecPtr2D dirichletBoundaryDofsVec, |
| 127 |
ConstXMultiVectorPtrVecPtr nodeListVec) |
| 128 |
{ |
| 129 |
FROSCH_TIMER_START_LEVELID(initializeTime,"GDSWCoarseOperator::initialize"); |
| 130 |
buildCoarseSpace(dimension,dofsPerNodeVec,repeatedNodesMapVec,repeatedDofMapsVec,dirichletBoundaryDofsVec,nodeListVec); |
| 131 |
this->assembleInterfaceCoarseSpace(); |
| 132 |
this->buildCoarseSolveMap(this->AssembledInterfaceCoarseSpace_->getBasisMapUnique()); |
| 133 |
this->IsInitialized_ = true; |
| 134 |
this->IsComputed_ = false; |
| 135 |
return 0; |
| 136 |
} |
| 137 |
|
| 138 |
template <class SC,class LO,class GO,class NO> |
| 139 |
void GDSWCoarseOperator<SC,LO,GO,NO>::describe(FancyOStream &out, |
| 140 |
const EVerbosityLevel verbLevel) const |
| 141 |
{ |
| 142 |
FROSCH_ASSERT(false,"describe() has to be implemented properly..."); |
| 143 |
} |
| 144 |
|
| 145 |
template <class SC,class LO,class GO,class NO> |
| 146 |
string GDSWCoarseOperator<SC,LO,GO,NO>::description() const |
| 147 |
{ |
| 148 |
return "GDSW Coarse Operator"; |
| 149 |
} |
| 150 |
|
| 151 |
template<class SC,class LO,class GO,class NO> |
| 152 |
typename GDSWCoarseOperator<SC,LO,GO,NO>::XMapPtr GDSWCoarseOperator<SC,LO,GO,NO>::BuildRepeatedMapCoarseLevel(ConstXMapPtr &nodesMap, |
| 153 |
UN dofsPerNode, |
| 154 |
ConstXMapPtrVecPtr dofsMaps, |
| 155 |
UN partitionType) |
| 156 |
{ |
| 157 |
FROSCH_ASSERT(false,"For GDSWCoarseOperator the ZoltanDual Option is not implemented!"); |
| 158 |
} |
| 159 |
|
| 160 |
template <class SC,class LO,class GO,class NO> |
| 161 |
int GDSWCoarseOperator<SC,LO,GO,NO>::buildCoarseSpace(UN dimension, |
| 162 |
ConstXMapPtr nodesMap) |
| 163 |
{ |
| 164 |
ConstXMapPtrVecPtr dofsMaps(1); |
| 165 |
dofsMaps[0] = nodesMap; |
| 166 |
buildCoarseSpace(dimension,1,nodesMap,dofsMaps); |
| 167 |
|
| 168 |
return 0; |
| 169 |
} |
| 170 |
|
| 171 |
template <class SC,class LO,class GO,class NO> |
| 172 |
int GDSWCoarseOperator<SC,LO,GO,NO>::buildCoarseSpace(UN dimension, |
| 173 |
ConstXMapPtr nodesMap, |
| 174 |
GOVecPtr dirichletBoundaryDofs) |
| 175 |
{ |
| 176 |
ConstXMapPtrVecPtr dofsMaps(1); |
| 177 |
dofsMaps[0] = nodesMap; |
| 178 |
buildCoarseSpace(dimension,1,nodesMap,dofsMaps,dirichletBoundaryDofs); |
| 179 |
|
| 180 |
return 0; |
| 181 |
} |
| 182 |
|
| 183 |
template <class SC,class LO,class GO,class NO> |
| 184 |
int GDSWCoarseOperator<SC,LO,GO,NO>::buildCoarseSpace(UN dimension, |
| 185 |
UN dofsPerNode, |
| 186 |
ConstXMapPtr nodesMap, |
| 187 |
ConstXMapPtrVecPtr dofsMaps) |
| 188 |
{ |
| 189 |
/* |
| 190 |
#ifdef FindOneEntryOnlyRowsGlobal_Matrix |
| 191 |
GOVecPtr dirichletBoundaryDofs = FindOneEntryOnlyRowsGlobal(this->K_.getConst(),nodesMap); |
| 192 |
#else |
| 193 |
GOVecPtr dirichletBoundaryDofs = FindOneEntryOnlyRowsGlobal(this->K_->getCrsGraph(),nodesMap); |
| 194 |
#end |
| 195 |
*/ |
| 196 |
FROSCH_WARNING("FROSch::GDSWCoarseOperator",this->Verbose_,"We do not have the right map (repeatedMap) to use FindOneEntryOnlyRowsGlobal. A variant that uses the row map could be implemented?! => We use dirichletBoundaryDofs = null for now."); |
| 197 |
GOVecPtr dirichletBoundaryDofs = null; |
| 198 |
buildCoarseSpace(dimension,dofsPerNode,nodesMap,dofsMaps,dirichletBoundaryDofs); |
| 199 |
|
| 200 |
return 0; |
| 201 |
} |
| 202 |
|
| 203 |
template <class SC,class LO,class GO,class NO> |
| 204 |
int GDSWCoarseOperator<SC,LO,GO,NO>::buildCoarseSpace(UN dimension, |
| 205 |
UN dofsPerNode, |
| 206 |
ConstXMapPtr nodesMap, |
| 207 |
ConstXMapPtrVecPtr dofsMaps, |
| 208 |
GOVecPtr dirichletBoundaryDofs) |
| 209 |
{ |
| 210 |
ConstXMultiVectorPtr nodeList; |
| 211 |
buildCoarseSpace(dimension,dofsPerNode,nodesMap,dofsMaps,dirichletBoundaryDofs,nodeList); |
| 212 |
|
| 213 |
return 0; |
| 214 |
} |
| 215 |
|
| 216 |
template <class SC,class LO,class GO,class NO> |
| 217 |
int GDSWCoarseOperator<SC,LO,GO,NO>::buildCoarseSpace(UN dimension, |
| 218 |
UN dofsPerNode, |
| 219 |
ConstXMapPtr nodesMap, |
| 220 |
ConstXMapPtrVecPtr dofsMaps, |
| 221 |
ConstXMultiVectorPtr nodeList) |
| 222 |
{ |
| 223 |
/* |
| 224 |
#ifdef FindOneEntryOnlyRowsGlobal_Matrix |
| 225 |
GOVecPtr dirichletBoundaryDofs = FindOneEntryOnlyRowsGlobal(this->K_.getConst(),nodesMap); |
| 226 |
#else |
| 227 |
GOVecPtr dirichletBoundaryDofs = FindOneEntryOnlyRowsGlobal(this->K_->getCrsGraph(),nodesMap); |
| 228 |
#end |
| 229 |
*/ |
| 230 |
FROSCH_WARNING("FROSch::GDSWCoarseOperator",this->Verbose_,"We do not have the right map (repeatedMap) to use FindOneEntryOnlyRowsGlobal. A variant that uses the row map could be implemented?! => We use dirichletBoundaryDofs = null for now."); |
| 231 |
GOVecPtr dirichletBoundaryDofs = null; |
| 232 |
buildCoarseSpace(dimension,dofsPerNode,nodesMap,dofsMaps,dirichletBoundaryDofs,nodeList); |
| 233 |
|
| 234 |
return 0; |
| 235 |
} |
| 236 |
|
| 237 |
template <class SC,class LO,class GO,class NO> |
| 238 |
int GDSWCoarseOperator<SC,LO,GO,NO>::buildCoarseSpace(UN dimension, |
| 239 |
UN dofsPerNode, |
| 240 |
ConstXMapPtr nodesMap, |
| 241 |
ConstXMapPtrVecPtr dofsMaps, |
| 242 |
GOVecPtr dirichletBoundaryDofs, |
| 243 |
ConstXMultiVectorPtr nodeList) |
| 244 |
{ |
| 245 |
FROSCH_DETAILTIMER_START_LEVELID(buildCoarseSpaceTime,"GDSWCoarseOperator::buildCoarseSpace"); |
| 246 |
FROSCH_ASSERT(dofsMaps.size()==dofsPerNode,"dofsMaps.size()!=dofsPerNode"); |
| 247 |
|
| 248 |
// Das könnte man noch ändern |
| 249 |
// TODO: DAS SOLLTE ALLES IN EINE FUNKTION IN HARMONICCOARSEOPERATOR |
| 250 |
resetCoarseSpaceBlock(this->NumberOfBlocks_,dimension,dofsPerNode,nodesMap,dofsMaps,dirichletBoundaryDofs,nodeList); |
| 251 |
|
| 252 |
return 0; |
| 253 |
} |
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
template <class SC,class LO,class GO,class NO> |
| 258 |
int GDSWCoarseOperator<SC,LO,GO,NO>::buildCoarseSpace(UN dimension, |
| 259 |
UNVecPtr dofsPerNodeVec, |
| 260 |
ConstXMapPtrVecPtr repeatedNodesMapVec, |
| 261 |
ConstXMapPtrVecPtr2D repeatedDofMapsVec, |
| 262 |
GOVecPtr2D dirichletBoundaryDofsVec, |
| 263 |
ConstXMultiVectorPtrVecPtr nodeListVec) |
| 264 |
{ |
| 265 |
FROSCH_DETAILTIMER_START_LEVELID(buildCoarseSpaceTime,"GDSWCoarseOperator::buildCoarseSpace"); |
| 266 |
// Das könnte man noch ändern |
| 267 |
// TODO: DAS SOLLTE ALLES IN EINE FUNKTION IN HARMONICCOARSEOPERATOR |
| 268 |
for (UN i=0; i<repeatedNodesMapVec.size(); i++) { |
| 269 |
resetCoarseSpaceBlock(this->NumberOfBlocks_,dimension,dofsPerNodeVec[i],repeatedNodesMapVec[i],repeatedDofMapsVec[i],dirichletBoundaryDofsVec[i],nodeListVec[i]); |
| 270 |
} |
| 271 |
return 0; |
| 272 |
} |
| 273 |
|
| 274 |
|
| 275 |
template <class SC,class LO,class GO,class NO> |
| 276 |
int GDSWCoarseOperator<SC,LO,GO,NO>::resetCoarseSpaceBlock(UN blockId, |
| 277 |
UN dimension, |
| 278 |
UN dofsPerNode, |
| 279 |
ConstXMapPtr nodesMap, |
| 280 |
ConstXMapPtrVecPtr dofsMaps, |
| 281 |
GOVecPtr dirichletBoundaryDofs, |
| 282 |
ConstXMultiVectorPtr nodeList) |
| 283 |
{ |
| 284 |
FROSCH_DETAILTIMER_START_LEVELID(resetCoarseSpaceBlockTime,"GDSWCoarseOperator::resetCoarseSpaceBlock"); |
| 285 |
FROSCH_ASSERT(dofsMaps.size()==dofsPerNode,"dofsMaps.size()!=dofsPerNode"); |
| 286 |
FROSCH_ASSERT(blockId<=this->NumberOfBlocks_,"Block does not exist yet and can therefore not be reset("+to_string(blockId)+" <= "+to_string(this->NumberOfBlocks_)+". "); |
| 287 |
|
| 288 |
if (!this->DistributionList_->get("Type","linear").compare("ZoltanDual")) { |
| 289 |
FROSCH_ASSERT(false,"RGDSWCoarseOperator:: Distribution Type ZoltanDual only works for IPOUHarmonicCoarseOperator"); |
| 290 |
} |
| 291 |
|
| 292 |
// Process the parameter list |
| 293 |
stringstream blockIdStringstream; |
| 294 |
blockIdStringstream << blockId+1; |
| 295 |
string blockIdString = blockIdStringstream.str(); |
| 296 |
RCP<ParameterList> coarseSpaceList = sublist(sublist(this->ParameterList_,"Blocks"),blockIdString.c_str()); |
| 297 |
|
| 298 |
CommunicationStrategy communicationStrategy = CreateOneToOneMap; |
| 299 |
if (!coarseSpaceList->get("Interface Communication Strategy","CreateOneToOneMap").compare("CrsMatrix")) { |
| 300 |
communicationStrategy = CommCrsMatrix; |
| 301 |
} else if (!coarseSpaceList->get("Interface Communication Strategy","CreateOneToOneMap").compare("CrsGraph")) { |
| 302 |
communicationStrategy = CommCrsGraph; |
| 303 |
} else if (!coarseSpaceList->get("Interface Communication Strategy","CreateOneToOneMap").compare("CreateOneToOneMap")) { |
| 304 |
communicationStrategy = CreateOneToOneMap; |
| 305 |
} else { |
| 306 |
FROSCH_ASSERT(false,"FROSch::GDSWCoarseOperator: Specify a valid communication strategy for the identification of the interface components."); |
| 307 |
} |
| 308 |
|
| 309 |
Verbosity verbosity = All; |
| 310 |
if (!coarseSpaceList->get("Verbosity","All").compare("None")) { |
| 311 |
verbosity = None; |
| 312 |
} else if (!coarseSpaceList->get("Verbosity","All").compare("All")) { |
| 313 |
verbosity = All; |
| 314 |
} else { |
| 315 |
FROSCH_ASSERT(false,"FROSch::GDSWCoarseOperator: Specify a valid verbosity level."); |
| 316 |
} |
| 317 |
|
| 318 |
bool useForCoarseSpace = coarseSpaceList->get("Use For Coarse Space",true); |
| 319 |
|
| 320 |
bool useVertexTranslations = coarseSpaceList->sublist("Custom").get("Vertices: translations",true); |
| 321 |
|
| 322 |
bool useShortEdgeTranslations = coarseSpaceList->sublist("Custom").get("ShortEdges: translations",true); |
| 323 |
bool useShortEdgeRotations = coarseSpaceList->sublist("Custom").get("ShortEdges: rotations",true); |
| 324 |
|
| 325 |
bool useStraightEdgeTranslations = coarseSpaceList->sublist("Custom").get("StraightEdges: translations",true); |
| 326 |
bool useStraightEdgeRotations = coarseSpaceList->sublist("Custom").get("StraightEdges: rotations",true); |
| 327 |
|
| 328 |
bool useEdgeTranslations = coarseSpaceList->sublist("Custom").get("Edges: translations",true); |
| 329 |
bool useEdgeRotations = coarseSpaceList->sublist("Custom").get("Edges: rotations",true); |
| 330 |
|
| 331 |
bool useFaceTranslations = coarseSpaceList->sublist("Custom").get("Faces: translations",true); |
| 332 |
bool useFaceRotations = coarseSpaceList->sublist("Custom").get("Faces: rotations",true); |
| 333 |
|
| 334 |
bool useRotations = coarseSpaceList->get("Rotations",true); |
| 335 |
if (useRotations && nodeList.is_null()) { |
| 336 |
useRotations = false; |
| 337 |
FROSCH_WARNING("FROSch::GDSWCoarseOperator",this->Verbose_,"Rotations cannot be used since nodeList.is_null()."); |
| 338 |
} |
| 339 |
if (!useRotations) { |
| 340 |
useShortEdgeRotations = false; |
| 341 |
useStraightEdgeRotations = false; |
| 342 |
useEdgeRotations = false; |
| 343 |
useFaceRotations = false; |
| 344 |
} |
| 345 |
|
| 346 |
if (useForCoarseSpace) { |
| 347 |
this->NumberOfBlocks_++; |
| 348 |
|
| 349 |
this->GammaDofs_.resize(this->GammaDofs_.size()+1); |
| 350 |
this->IDofs_.resize(this->IDofs_.size()+1); |
| 351 |
this->InterfaceCoarseSpaces_.resize(this->InterfaceCoarseSpaces_.size()+1); |
| 352 |
this->DofsMaps_.resize(this->DofsMaps_.size()+1); |
| 353 |
this->DofsPerNode_.resize(this->DofsPerNode_.size()+1); |
| 354 |
|
| 355 |
this->DofsMaps_[blockId] = dofsMaps; |
| 356 |
this->DofsPerNode_[blockId] = dofsPerNode; |
| 357 |
|
| 358 |
Array<GO> tmpDirichletBoundaryDofs(dirichletBoundaryDofs()); // Here, we do a copy. Maybe, this is not necessary |
| 359 |
sortunique(tmpDirichletBoundaryDofs); |
| 360 |
|
| 361 |
DDInterface_.reset(new DDInterface<SC,LO,GO,NO>(dimension,this->DofsPerNode_[blockId],nodesMap.getConst(),verbosity,this->LevelID_,communicationStrategy)); |
| 362 |
DDInterface_->resetGlobalDofs(dofsMaps); |
| 363 |
DDInterface_->removeDirichletNodes(tmpDirichletBoundaryDofs()); |
| 364 |
|
| 365 |
if (useVertexTranslations||useShortEdgeTranslations||useShortEdgeRotations||useStraightEdgeTranslations||useStraightEdgeRotations||useEdgeTranslations||useEdgeRotations||useFaceTranslations||useFaceRotations) { |
| 366 |
EntitySetPtr interface = this->DDInterface_->getInterface(); |
| 367 |
EntitySetPtr interior = this->DDInterface_->getInterior(); |
| 368 |
|
| 369 |
if (this->Verbose_) { |
| 370 |
cout |
| 371 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 372 |
<< setw(89) << "-----------------------------------------------------------------------------------------" |
| 373 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 374 |
<< "| " |
| 375 |
<< left << setw(74) << "GDSWCoarseOperator " << right << setw(8) << "(Level " << setw(2) << this->LevelID_ << ")" |
| 376 |
<< " |" |
| 377 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 378 |
<< setw(89) << "=========================================================================================" |
| 379 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 380 |
<< "| " << left << setw(41) << "Block" << right |
| 381 |
<< " | " << setw(41) << blockId |
| 382 |
<< " |" |
| 383 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 384 |
<< "| " << left << setw(41) << "Spatial dimensions" << right |
| 385 |
<< " | " << setw(41) << dimension |
| 386 |
<< " |" |
| 387 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 388 |
<< "| " << left << setw(41) << "Number of degrees of freedom per node" << right |
| 389 |
<< " | " << setw(41) << dofsPerNode |
| 390 |
<< " |" |
| 391 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 392 |
<< setw(89) << "-----------------------------------------------------------------------------------------" |
| 393 |
<< endl; |
| 394 |
} |
| 395 |
|
| 396 |
// Check for interface |
| 397 |
if (interface->getEntity(0)->getNumNodes()==0) { |
| 398 |
FROSCH_NOTIFICATION("FROSch::GDSWCoarseOperator",this->Verbose_,"No interface found => Volume functions will be used instead."); |
| 399 |
this->computeVolumeFunctions(blockId,dimension,nodesMap,nodeList,interior); |
| 400 |
} else { |
| 401 |
this->GammaDofs_[blockId] = LOVecPtr(this->DofsPerNode_[blockId]*interface->getEntity(0)->getNumNodes()); |
| 402 |
this->IDofs_[blockId] = LOVecPtr(this->DofsPerNode_[blockId]*interior->getEntity(0)->getNumNodes()); |
| 403 |
for (UN k=0; k<this->DofsPerNode_[blockId]; k++) { |
| 404 |
for (UN i=0; i<interface->getEntity(0)->getNumNodes(); i++) { |
| 405 |
this->GammaDofs_[blockId][this->DofsPerNode_[blockId]*i+k] = interface->getEntity(0)->getLocalDofID(i,k); |
| 406 |
} |
| 407 |
for (UN i=0; i<interior->getEntity(0)->getNumNodes(); i++) { |
| 408 |
this->IDofs_[blockId][this->DofsPerNode_[blockId]*i+k] = interior->getEntity(0)->getLocalDofID(i,k); |
| 409 |
} |
| 410 |
} |
| 411 |
|
| 412 |
this->InterfaceCoarseSpaces_[blockId].reset(new CoarseSpace<SC,LO,GO,NO>(this->MpiComm_,this->SerialComm_)); |
| 413 |
|
| 414 |
if (this->ParameterList_->get("Test Unconnected Interface",true)) { |
| 415 |
DDInterface_->divideUnconnectedEntities(this->K_); |
| 416 |
} |
| 417 |
|
| 418 |
DDInterface_->sortVerticesEdgesFaces(nodeList); |
| 419 |
|
| 420 |
EntitySetPtr interface = DDInterface_->getInterface(); |
| 421 |
EntitySetPtr interior = DDInterface_->getInterior(); |
| 422 |
|
| 423 |
//////////////////////////////// |
| 424 |
// Build Processor Map Coarse // |
| 425 |
//////////////////////////////// |
| 426 |
DDInterface_->buildEntityMaps(useVertexTranslations, |
| 427 |
useShortEdgeTranslations||useShortEdgeRotations, |
| 428 |
useStraightEdgeTranslations || useStraightEdgeRotations, |
| 429 |
useEdgeTranslations || useEdgeRotations, |
| 430 |
useFaceTranslations || useFaceRotations, |
| 431 |
false); |
| 432 |
|
| 433 |
// Vertices |
| 434 |
if (useVertexTranslations) { |
| 435 |
XMultiVectorPtrVecPtr translations = this->computeTranslations(blockId,DDInterface_->getVertices()); |
| 436 |
ConstXMapPtr verticesEntityMap = DDInterface_->getVertices()->getEntityMap(); |
| 437 |
for (UN i=0; i<translations.size(); i++) { |
| 438 |
this->InterfaceCoarseSpaces_[blockId]->addSubspace(verticesEntityMap,null,translations[i]); |
| 439 |
} |
| 440 |
} |
| 441 |
// ShortEdges |
| 442 |
if (useShortEdgeTranslations) { |
| 443 |
XMultiVectorPtrVecPtr translations = this->computeTranslations(blockId,DDInterface_->getShortEdges()); |
| 444 |
ConstXMapPtr shortEdgesEntityMap = DDInterface_->getShortEdges()->getEntityMap(); |
| 445 |
for (UN i=0; i<translations.size(); i++) { |
| 446 |
this->InterfaceCoarseSpaces_[blockId]->addSubspace(shortEdgesEntityMap,null,translations[i]); |
| 447 |
} |
| 448 |
} |
| 449 |
if (useShortEdgeRotations) { |
| 450 |
XMultiVectorPtrVecPtr rotations = this->computeRotations(blockId,dimension,nodeList,DDInterface_->getShortEdges(),(dimension==3)); |
| 451 |
ConstXMapPtr shortEdgesEntityMap = DDInterface_->getShortEdges()->getEntityMap(); |
| 452 |
for (UN i=0; i<rotations.size(); i++) { |
| 453 |
this->InterfaceCoarseSpaces_[blockId]->addSubspace(shortEdgesEntityMap,null,rotations[i]); |
| 454 |
} |
| 455 |
} |
| 456 |
// StraightEdges |
| 457 |
if (useStraightEdgeTranslations) { |
| 458 |
XMultiVectorPtrVecPtr translations = this->computeTranslations(blockId,DDInterface_->getStraightEdges()); |
| 459 |
ConstXMapPtr straightEdgesEntityMap = DDInterface_->getStraightEdges()->getEntityMap(); |
| 460 |
for (UN i=0; i<translations.size(); i++) { |
| 461 |
this->InterfaceCoarseSpaces_[blockId]->addSubspace(straightEdgesEntityMap,null,translations[i]); |
| 462 |
} |
| 463 |
} |
| 464 |
if (useStraightEdgeRotations) { |
| 465 |
XMultiVectorPtrVecPtr rotations = this->computeRotations(blockId,dimension,nodeList,DDInterface_->getStraightEdges(),(dimension==3)); |
| 466 |
ConstXMapPtr straightEdgesEntityMap = DDInterface_->getStraightEdges()->getEntityMap(); |
| 467 |
for (UN i=0; i<rotations.size(); i++) { |
| 468 |
this->InterfaceCoarseSpaces_[blockId]->addSubspace(straightEdgesEntityMap,null,rotations[i]); |
| 469 |
} |
| 470 |
} |
| 471 |
// Edges |
| 472 |
if (useEdgeTranslations) { |
| 473 |
XMultiVectorPtrVecPtr translations = this->computeTranslations(blockId,DDInterface_->getEdges()); |
| 474 |
ConstXMapPtr edgesEntityMap = DDInterface_->getEdges()->getEntityMap(); |
| 475 |
for (UN i=0; i<translations.size(); i++) { |
| 476 |
this->InterfaceCoarseSpaces_[blockId]->addSubspace(edgesEntityMap,null,translations[i]); |
| 477 |
} |
| 478 |
} |
| 479 |
if (useEdgeRotations) { |
| 480 |
XMultiVectorPtrVecPtr rotations = this->computeRotations(blockId,dimension,nodeList,DDInterface_->getEdges()); |
| 481 |
ConstXMapPtr edgesEntityMap = DDInterface_->getEdges()->getEntityMap(); |
| 482 |
for (UN i=0; i<rotations.size(); i++) { |
| 483 |
this->InterfaceCoarseSpaces_[blockId]->addSubspace(edgesEntityMap,null,rotations[i]); |
| 484 |
} |
| 485 |
} |
| 486 |
// Faces |
| 487 |
if (useFaceTranslations) { |
| 488 |
XMultiVectorPtrVecPtr translations = this->computeTranslations(blockId,DDInterface_->getFaces()); |
| 489 |
ConstXMapPtr facesEntityMap = DDInterface_->getFaces()->getEntityMap(); |
| 490 |
for (UN i=0; i<translations.size(); i++) { |
| 491 |
this->InterfaceCoarseSpaces_[blockId]->addSubspace(facesEntityMap,null,translations[i]); |
| 492 |
} |
| 493 |
} |
| 494 |
if (useFaceRotations) { |
| 495 |
XMultiVectorPtrVecPtr rotations = this->computeRotations(blockId,dimension,nodeList,DDInterface_->getFaces()); |
| 496 |
ConstXMapPtr facesEntityMap = DDInterface_->getFaces()->getEntityMap(); |
| 497 |
for (UN i=0; i<rotations.size(); i++) { |
| 498 |
this->InterfaceCoarseSpaces_[blockId]->addSubspace(facesEntityMap,null,rotations[i]); |
| 499 |
} |
| 500 |
} |
| 501 |
|
| 502 |
this->InterfaceCoarseSpaces_[blockId]->assembleCoarseSpace(); |
| 503 |
|
| 504 |
if (this->Verbose_) { |
| 505 |
cout |
| 506 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 507 |
<< setw(89) << "-----------------------------------------------------------------------------------------" |
| 508 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 509 |
<< "| " |
| 510 |
<< left << setw(74) << "> GDSW coarse space " << right << setw(8) << "(Level " << setw(2) << this->LevelID_ << ")" |
| 511 |
<< " |" |
| 512 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 513 |
<< setw(89) << "=========================================================================================" |
| 514 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 515 |
<< "| " << left << setw(19) << "Vertices " << " | " << setw(19) << "Translations " << right |
| 516 |
<< " | " << setw(41) << boolalpha << useVertexTranslations << noboolalpha |
| 517 |
<< " |" |
| 518 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 519 |
<< "| " << left << setw(19) << "ShortEdges " << " | " << setw(19) << "Translations " << right |
| 520 |
<< " | " << setw(41) << boolalpha << useShortEdgeTranslations << noboolalpha |
| 521 |
<< " |" |
| 522 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 523 |
<< "| " << left << setw(19) << "ShortEdges " << " | " << setw(19) << "Rotations " << right |
| 524 |
<< " | " << setw(41) << boolalpha << useShortEdgeRotations << noboolalpha |
| 525 |
<< " |" |
| 526 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 527 |
<< "| " << left << setw(19) << "StraightEdges " << " | " << setw(19) << "Translations " << right |
| 528 |
<< " | " << setw(41) << boolalpha << useStraightEdgeTranslations << noboolalpha |
| 529 |
<< " |" |
| 530 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 531 |
<< "| " << left << setw(19) << "StraightEdges " << " | " << setw(19) << "Rotations " << right |
| 532 |
<< " | " << setw(41) << boolalpha << useStraightEdgeRotations << noboolalpha |
| 533 |
<< " |" |
| 534 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 535 |
<< "| " << left << setw(19) << "Edges " << " | " << setw(19) << "Translations " << right |
| 536 |
<< " | " << setw(41) << boolalpha << useEdgeTranslations << noboolalpha |
| 537 |
<< " |" |
| 538 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 539 |
<< "| " << left << setw(19) << "Edges " << " | " << setw(19) << "Rotations " << right |
| 540 |
<< " | " << setw(41) << boolalpha << useEdgeRotations << noboolalpha |
| 541 |
<< " |" |
| 542 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 543 |
<< "| " << left << setw(19) << "Faces " << " | " << setw(19) << "Translations " << right |
| 544 |
<< " | " << setw(41) << boolalpha << useFaceTranslations << noboolalpha |
| 545 |
<< " |" |
| 546 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 547 |
<< "| " << left << setw(19) << "Faces " << " | " << setw(19) << "Rotations " << right |
| 548 |
<< " | " << setw(41) << boolalpha << useFaceRotations << noboolalpha |
| 549 |
<< " |" |
| 550 |
<< "\n" << setw(FROSCH_OUTPUT_INDENT) << " " |
| 551 |
<< setw(89) << "-----------------------------------------------------------------------------------------" |
| 552 |
<< endl; |
| 553 |
} |
| 554 |
} |
| 555 |
} |
| 556 |
} |
| 557 |
return 0; |
| 558 |
} |
| 559 |
} |
| 560 |
|
| 561 |
#endif |