Go to the documentation of this file.
6 #ifndef spcDomainDecomp_hh
7 #define spcDomainDecomp_hh
20 #define DDSpaceConstr_D 0
21 #define DDSpaceDestr_D 0
22 #define DDSpaceRebuild_D 0
23 #define DDSpaceGetIndices_D 0
24 #define DDSpaceInfoIndices_D 0
51 virtual std::ostream&
info(std::ostream& os)
const;
61 return os <<
"DDSpace(" << domains_ <<
" domains)";
95 uint spcNo = 0, uint*
offset = 0);
109 inline virtual uint
dim()
const;
110 inline virtual uint
nelm()
const;
117 virtual uint
offset()
const;
119 virtual const F&
space(uint i)
const;
128 virtual std::ostream&
info(std::ostream& os)
const;
156 template<
class G,
class H>
165 uint spcNo, uint* offset) :
166 DDSpace<typename F::t_type>(), spcNo_(spcNo), spcBuild_(0),
170 std::unique_ptr<concepts::Scan2> sc(prebuild.mesh().scan());
174 attributes.insert(attr);
187 nonvalid <<
" in given domain " << *i);
225 const Set<uint> nonactiv = attributes - *i;
227 k != nonactiv.end(); ++k)
239 idx = &spc->lastIdx();
252 uint k = this->domains();
254 for (; i != spaces_.rend(); ++i) {
264 os <<
"DomainDecomp(" << this->domains_ <<
" domains, ";
268 os <<
"dim = " << dim() <<
", nelm = " << nelm() <<
", ";
269 for (uint i = 0; i < spaces_.size();) {
270 os <<
"space(" << i <<
") = " << space(i);
271 #if DDSpaceInfoIndices_D
272 os <<
", I(" << i <<
") = " << indicesI(i)
273 <<
", B(" << i <<
") = " << indicesB(i);
275 os <<
", I(" << i <<
").dim = " << indicesI(i).dim()
276 <<
", B(" << i <<
").dim = " << indicesB(i).dim();
278 if (++i < spaces_.size()) os <<
", ";
304 (*i)->lastIdx() = (*i)->offset();
306 (*i)->prebuild().clearAllIndices(spcNo_);
308 for (; i != spaces_.end(); ++i) {
314 *b++ = (*i)->available().second;
316 nelm_ = (*i)->nelm();
322 std::unique_ptr<typename Space<typename F::t_type>::Scanner> sc(
nullptr);
323 for (i = spaces_.begin(); i != spaces_.end(); ++i) {
324 sc.reset((*i)->scan());
329 if (elm->
T().n() > 0) {
338 for(uint j = 0; j < this->domains_; ++j) {
339 this->indicesI_[j].clear();
340 this->indicesB_[j].clear();
346 std::unique_ptr<concepts::Scan2> se(spaces_[0]->prebuild().mesh().scan());
348 getIndices_(spaces_[0]->prebuild(), (*se)++.connector(), indices);
351 for(uint j = 0; j < this->domains_; ++j) {
352 DEBUGL(1,
"indicesI_[" << j <<
"] = " << this->indicesI_[j]);
353 DEBUGL(1,
"indicesB_[" << j <<
"] = " << this->indicesB_[j]);
356 i = spaces_.begin(); k = 0;
357 for (; i != spaces_.end(); ++i)
358 DEBUGL(1,
"Space(" << k++ <<
") = " << **i);
365 const uint* b = spcBuild_;
367 while(i != spaces_.end() && (*i)->available().first &&
368 (*i)->available().second == *b++) ++i;
369 return i == spaces_.end();
378 return (*spaces_.begin())->dim();
397 return (*spaces_.begin())->lastIdx();
402 return (*spaces_.begin())->offset();
422 return this->indicesI_[i];
430 return this->indicesB_[i];
434 template<
class G,
class H>
446 &indicesI = this->indicesI_[d];
457 cntr.key() <<
" - dim = " << dim <<
", idx = " << idx);
464 "recent = " << recent <<
", occured = " << occured);
465 if (!occured.empty()) {
467 indicesB = indicesB || occured;
471 for(uint j = 0; j < this->domains_; ++j)
474 this->indicesI_[j] = this->indicesI_[j] - occuredDomain;
475 this->indicesB_[j] = this->indicesB_[j] || occuredDomain;
478 if (!recent.empty()) {
479 indicesI = indicesI || recent;
482 indices = indices || idx;
485 "indicesI_[" << d <<
"] = " << this->indicesI_[d]);
487 "indicesB_[" << d <<
"] = " << this->indicesB_[d]);
497 for(uint j = 0; (chld = cntr.child(j)) != 0; ++j)
498 getIndices_(prebuild, *chld, indices);
virtual std::ostream & info(std::ostream &os) const
Returns all index sets for dof at boundary of each domain.
const uint domains() const
Returns number of domains/spaces.
An abstract class for an element of a space.
virtual std::ostream & info(std::ostream &os) const
Returns all index sets for dof at boundary of each domain.
void rebuild()
Rebuilds the spaces.
virtual uint dim() const
Returns the dimension of the space.
uint attrib() const
Returns the attribute.
#define conceptsException(exc)
Prepares an exception for throwing.
Abstract class for a space.
uint domains_
Number of domains/spaces.
Sequence< Set< IndexRange > > indicesI_
Index sets of dof inside and at the boundary for each domain/space.
Joiner class with multiple successors, i.e.
DDSpace(uint domains=0)
Constructor.
#define conceptsAssert(cond, exc)
Assert that a certain condition is fulfilled.
virtual const TMatrixBase< F > & T() const =0
Returns the T matrix of the element.
Array< uint > spcBuild_
Array of build number of the spaces at last call of rebuild()
#define DDSpaceGetIndices_D
bool available() const
Returns true, if space is available, false, if it has to be rebuilt.
virtual const Space< F > & space(uint i) const =0
Returns space belonging to i th domain.
#define DEBUGL(doit, msg)
HashMap< uint > attrToDomain_
Mapping from attribute to domain number.
virtual const Set< IndexRange > indicesI(uint i) const =0
Returns index set for dof inside the i th domain.
Class for holding an offset of global indices of space.
concepts::Element< typename F::t_type > Element
Element type.
uint nelm_
Number of elements in all spaces.
Exception class for assertions.
Sequence< Set< IndexRange > > indicesB_
void getIndices_(const G &prebuild, const H &cntr, Set< IndexRange > &indices)
virtual Scan * scan() const
Returns a scanner to iterate over the elements of the space.
An abstract class for scanning a mesh (a set of cells) or a space (a set of elements).
virtual uint & lastIdx()
Returns last global index of the space.
Sequence with operations, output operator, and method of the particular element types.
concepts::Scan< Element > Scan
virtual const Set< IndexRange > indicesB(uint i) const =0
Returns all index sets for dof inside each domain.
concepts::Joiner< Element *, 1 > * elm_
Array of the elements of all domains.
Indicates that the space on which a function was called was not yet correctly built.
void resize(const uint sz)
Resizes the array.
Sequence< CellConditions > cc_
Cell conditions for the spaces.
Exception class to express a missing feature.
virtual uint nelm() const
Returns the number of elements in the space.
static void destructor(Joiner< T, nlnk > *&j, bool values=true)
Static function to delete the list/tree.
Sequence< F * > spaces_
Spaces belonging to domains.
virtual uint offset() const
Returns the offset, returns 0 if space is not a subspace or first one.
void zeros()
Fills the memory with zeros.
#define conceptsAssert3(cond, exc, msg)
Assert that a certain condition is fulfilled.
virtual const F & space(uint i) const
Returns space belonging to i th domain.
DomainDecomp(G &prebuild, Sequence< Set< uint > > domains, BoundaryConditions *bc=0, CellConditions *cc=0, uint spcNo=0, uint *offset=0)
Constructor.
Domain decomposition space.
virtual const Set< IndexRange > indicesI(uint i) const
Returns index set for dof inside the i th domain.
uint spcNo_
Number for the global indices of the domains, for distinguishing between global indices on same topol...
Attributes for elements of the topology.
Basic namespace for Concepts-2.
Scanner for a list of pointers.
virtual const Set< IndexRange > indicesB(uint i) const
Returns index set for dof at the boundary the i th domain.