QuOc

 

Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions

tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType > Class Template Reference

#include <tpCFEGrid.h>

Inheritance diagram for tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >:
tpcfe::CFEGridDefinition qc::RectangularGrid< qc::QC_3D > qc::GridStructure tpcfe::CFEGrid< _RealType, _CT, NodalCoeffType >

List of all members.

Public Types

typedef _RealType RealType
typedef qc::BitArray< qc::QC_3D > BitArrayType
typedef tpcfe::CFEVirtualNode
< RealType, _CT,
NodalCoeffType > 
VNType
typedef VNType::IndexType VNIndexType
typedef std::map< typename
VNType::IndexType, VNType * > 
VNMapType
typedef std::map< typename
VNType::IndexType, VNType * >
::iterator 
VNMapTypeIt
typedef std::map< typename
VNType::IndexType, VNType * >
::const_iterator 
VNMapTypeConstIt

Public Member Functions

 CFEGridBase (const int Depth)
 CFEGridBase (const qc::GridSize< qc::QC_3D > &Sizes)
 ~CFEGridBase ()
void setVerboseMode (const bool whichMode)
const VNMapTypevirtualNodeMapRef () const
const VNTypegetVirtualNodeRef (const int gIdx0, const int gIdx1) const
VNTypegetVirtualNodeRef (const int gIdx0, const int gIdx1)
void setAdjustVirtualNodes (const RealType AdjustVirtualNodes)
RealType getAdjustVirtualNodes () const
void setAdjustLevelset (const RealType AdjustLevelset)
 must be called before setting domain or adding structure
ConstraintType getCT () const
void setDomainRef (tpcfe::CFEStructure< RealType > &Domain)
void addStructureFrom (const qc::ScalarArray< RealType, qc::QC_3D > &Strct)
void addStructureRef (CFEStructure< RealType > &Strct)
const CFEStructure< RealType > & getDomainRef () const
const CFEStructure< RealType > & getStructureRefForType (const CFEType type) const
const CFEStructure< RealType > & getStructureRef (const short num) const
void removeDomain ()
void removeStructure (const int which)
bool hasDomain () const
int getNumStructures () const
void detectVirtualNodes ()
void detectAndInitVirtualNodes (const qc::AArray< NodalCoeffType, qc::QC_3D > &nodalCoeff)
RealType relaxedDetectAndInitVirtualNodes (const qc::AArray< NodalCoeffType, qc::QC_3D > &nodalCoeff, const RealType initThreshold, const RealType thresholdStep)
const BitArrayTypegetDomainNodeMaskRef () const
bool isInsideDomain (const qc::CoordType &pos) const
void setDomainNodeMask (BitArrayType &dmask)
 this function only sets the domainNode mask but does not initialize any virtual nodes or things like that.
void setDirichletMask (BitArrayType &dmask)
void setDOFMask (BitArrayType &dmask)
void setDOFMaskFromDirichletAndDomainNodeMask () const
void setDOFMaskFromDirichletMask () const
bool hasDirichletMask () const
bool hasDomainNodeMask () const
bool hasDOFMask () const
const BitArrayTypegetDirichletMaskRef () const
const BitArrayTypegetDOFMaskRef () const
void setInnerNodeMask (qc::BitArray< qc::QC_3D > &innerNodes) const
 set all entries of the given BitArray<qc::QC_3D> to true where levelset function has negative values
bool isDomainNode (const int globalIndex) const
bool isDomainNode (const qc::CoordType &pos) const
bool isDirichletNode (const int globalIndex) const
bool isDirichletNode (const qc::CoordType &pos) const
bool isDOFNode (const int globalIndex) const
bool isDOFNode (const qc::CoordType &pos) const
bool isInnerNode (const qc::CoordType &pos) const
bool isInnerNode (const int globalIndex) const
bool isNearInterface (const qc::CoordType &pos, const short struc=0) const
void restrictDirichletNodes (aol::Vector< RealType > &arg) const
 Sets all entries of arg at Dirichlet nodes to zero.
void restrictDirichletNodes (aol::MultiVector< RealType > &arg) const
void restrictToDofs (aol::Vector< RealType > &arg) const
 Sets all entries of arg at non-dofs to zero (outside of domain of computation and Dirichlet nodes).
void restrictToDofs (aol::MultiVector< RealType > &arg) const
void restrictToInnerNodes (qc::ScalarArray< RealType, qc::QC_3D > &arg) const
bool getStructureValues (CFEElement< RealType > &el) const
void getCutRelations (CFEElement< RealType > &el) const
void dump (ostream &out) const
bool isInterfaced (const CFEElement< RealType > &e) const
bool isEdgeInterfaced (const qc::CoordType pos0, const qc::CoordType pos1, const short stru=0) const
 Return whether the edge between nodes is interfaced by structure.
RealType getTotalInnerVolume () const
RealType getTotalPartialVolume (const signed char which) const
int getNumDOFs () const
int getCfeGridIndexOffset (const int i) const
RealType getCutRelationBetween (const qc::CoordType &pos0, const qc::CoordType &pos1, const signed char stru) const
 Returns cut relation of structure stru between two nodes (given by global index). This only makes sense if the two nodes are connected by an edge (which would be expensive to check).
void removeVirtualNodes ()
void setCoarsenedFlag (const bool isCo)
 For grids not on the finest level, a different matrix structure may be necessary.
bool isCoarsened () const

Public Attributes

bool _inadmissibleSignatureWarningPrinted

Static Public Attributes

static const tpcfe::ConstraintType CT = _CT

Protected Member Functions

void doRestrictToDomain (aol::Vector< RealType > &arg) const
 Sets all entries of arg outside of domain of computation to zero.
void doRestrictToDomain (aol::MultiVector< RealType > &arg) const
void setDomainRef (tpcfe::CFEStructure< RealType > &Domain, const bool deleteDomain)
void initVirtualNodes (const qc::AArray< NodalCoeffType, qc::QC_3D > &nodalCoeff)
void setElTypes (int structureNo)
void removeStructureFromElTypes (const signed char which)
void getStructureValues (const CFEStructure< RealType > &s, CFEElement< RealType > &el) const
bool interfaced (const CFEElement< RealType > &el, int parentTetra) const

Protected Attributes

std::vector< CFEStructure
< RealType > * > 
_structure
aol::BitVector _deleteStructures
 here, we may store multiple level set functions describing regions with different coefficients
bool _virtualNodesInitialized
bool _verboseMode
VNMapType _vNode
CFEStructure< RealType > * _pDomain
 this is used for describing the domain of computation (e.g. based on a level set).
BitArrayType_pDomainNodeMask
 nodes on which computation is performed in case of complicated domains (interior and neighboring), NULL: all inside, true <=> node inside
BitArrayType_pDirichletMask
 dirichlet nodes, NULL: no dirichlet nodes, true <=> dirichlet node
BitArrayType_pDOFMask
 degrees of freedom. note: except for finest grid, *not* all non-Dirichlet domainNodes are DOFs.
RealType _adjustLevelset
 If levelset function is closer to zero than this value (in 1), it is adjusted by this value.
RealType _adjustVirtualNodes
 If virtual node is closer to regular grid point than this value times the grid width, it is moved away from the regular grid point.
bool _isCoarsened
 Store whether grid was created by multigrid solver and represents coarsened level (i.e. no level set function describing geometry present). This is important for creating appropriate matrices.

Private Member Functions

 CFEGridBase (const CFEGridBase< _RealType, _CT, NodalCoeffType > &other)
CFEGridBase< _RealType, _CT,
NodalCoeffType > & 
operator= (const CFEGridBase< _RealType, _CT, NodalCoeffType > &)
int getUniformGridIndexOffset (int) const

Detailed Description

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
class tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >

Class for grids with interfaces A Grid contains a domain and it contains Structures

Definition at line 107 of file tpCFEGrid.h.


Member Typedef Documentation

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
typedef qc::BitArray<qc::QC_3D> tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::BitArrayType

Definition at line 114 of file tpCFEGrid.h.

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
typedef VNType::IndexType tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::VNIndexType

Definition at line 116 of file tpCFEGrid.h.

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
typedef std::map<typename VNType::IndexType, VNType*> tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::VNMapType

Reimplemented in tpcfe::CFEGrid< _RealType, CFE_DOMAIN, _RealType >.

Definition at line 117 of file tpCFEGrid.h.

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
typedef std::map<typename VNType::IndexType, VNType*>::const_iterator tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::VNMapTypeConstIt

Definition at line 119 of file tpCFEGrid.h.

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
typedef std::map<typename VNType::IndexType, VNType*>::iterator tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::VNMapTypeIt

Definition at line 118 of file tpCFEGrid.h.

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
typedef tpcfe::CFEVirtualNode< RealType, _CT, NodalCoeffType > tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::VNType

Reimplemented in tpcfe::CFEGrid< _RealType, CFE_DOMAIN, _RealType >.

Definition at line 115 of file tpCFEGrid.h.


Constructor & Destructor Documentation

template<typename _RealType , tpcfe::ConstraintType _CT, typename NodalCoeffType >
tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::CFEGridBase ( const int  Depth  )  [explicit]

Construct a CFE grid which does not contain any structure

Definition at line 17 of file tpCFEGrid.cpp.

References tpcfe::CFELookup< RealType >::construct().

                                                                              :
    CFEGridDefinition ( Depth ),
    _inadmissibleSignatureWarningPrinted ( false ),
    _structure ( 0 ),
    _deleteStructures ( MAX_STRUCT_ID + 1 ),
    _virtualNodesInitialized ( false ),
    _verboseMode ( false ),
    _pDomain ( NULL ),
    _pDomainNodeMask ( NULL ), _pDirichletMask ( NULL ), _pDOFMask ( NULL ),
    _adjustLevelset ( 1.0e-6 ), _adjustVirtualNodes ( 0.0 ),
    _isCoarsened ( false ) {

  int mem = CFELookup<RealType>::construct();
  if ( _verboseMode ) {
    cerr << "Lookup table is of size " << mem / 1024 << "KiB " << endl;
  }

  _deleteStructures.setAll ( false );
}

template<typename _RealType , tpcfe::ConstraintType _CT, typename NodalCoeffType >
tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::CFEGridBase ( const qc::GridSize< qc::QC_3D > &  Sizes  )  [explicit]

Definition at line 39 of file tpCFEGrid.cpp.

References tpcfe::CFELookup< RealType >::construct().

                                                                                               :
    CFEGridDefinition ( Sizes ),
    _inadmissibleSignatureWarningPrinted ( false ),
    _structure ( 0 ),
    _deleteStructures ( MAX_STRUCT_ID + 1 ),
    _virtualNodesInitialized ( false ),
    _verboseMode ( false ),
    _pDomain ( NULL ),
    _pDomainNodeMask ( NULL ), _pDirichletMask ( NULL ), _pDOFMask ( NULL ),
    _adjustLevelset ( 1.0e-6 ), _adjustVirtualNodes ( 0.0 ),
    _isCoarsened ( false ) {

  int mem = CFELookup<RealType>::construct();
  if ( _verboseMode ) {
    cerr << "Lookup table is of size " << mem / 1024 << "KiB " << endl;
  }

  _deleteStructures.setAll ( false );
}

template<typename _RealType , tpcfe::ConstraintType _CT, typename NodalCoeffType >
tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::~CFEGridBase (  ) 

Definition at line 61 of file tpCFEGrid.cpp.

References tpcfe::CFELookup< RealType >::destruct(), and tpcfe::MAX_STRUCT_ID.

                                                               {
  removeVirtualNodes();

  for ( unsigned int i = 0; i < _structure.size(); ++i ) {
    if ( _deleteStructures[i] ) {
      delete ( _structure[i] );
    }
  }

  if ( _deleteStructures[ MAX_STRUCT_ID ] && _pDomain )  delete _pDomain;
  if ( _pDomainNodeMask )  delete _pDomainNodeMask;
  if ( _pDirichletMask )   delete _pDirichletMask;
  if ( _pDOFMask )         delete _pDOFMask;

  CFELookup<RealType>::destruct();
}

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::CFEGridBase ( const CFEGridBase< _RealType, _CT, NodalCoeffType > &  other  )  [private]

Member Function Documentation

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::addStructureFrom ( const qc::ScalarArray< RealType, qc::QC_3D > &  Strct  )  [inline]

Add a structure constructed from a ScalarArray<QC_3D> to this grid (level set data will be deep copied)

Definition at line 236 of file tpCFEGrid.h.

Referenced by tpcfe::CFETester::CFELocalAssemblyTesterLIEHR(), and tpcfe::CFETester::CFEStandardOpTester().

                                                                          {
    CFEStructureAffine<RealType> *Structure = new CFEStructureAffine<RealType>;
    Structure->setImageFrom ( Strct, _adjustLevelset );
    _deleteStructures.set ( _structure.size(), true );
    addStructureRef ( *Structure );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::addStructureRef ( CFEStructure< RealType > &  Strct  )  [inline]

Add reference to a CFEStructure

Definition at line 245 of file tpCFEGrid.h.

Referenced by tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::addStructureFrom().

                                                         {
    if ( _structure.size() > ( tpcfe::MAX_STRUCT_ID - 2 ) ) {
      throw aol::Exception ( "Cannot add another structure.", __FILE__, __LINE__ );
    }
    if ( _structure.size() == 1 ) {
      throw aol::Exception ( "tpcfe::CFEGridBase: trying to add more than one structure. This is completely untested.", __FILE__, __LINE__ );
    }
    _structure.push_back ( &Strct );
    setElTypes ( _structure.size () - 1 );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::detectAndInitVirtualNodes ( const qc::AArray< NodalCoeffType, qc::QC_3D > &  nodalCoeff  )  [inline]

Performs detection and initialization of weights and constraints in the jumping coefficient case for virtual nodes based on an AArray of coefficients at the grid nodes

Definition at line 332 of file tpCFEGrid.h.

Referenced by tpcfe::CFETester::CFELocalAssemblyTesterLIEHR(), and tpcfe::CFETester::CFEStandardOpTester().

                                                                                         {
    if ( ( CT == CFE_TPOS ) || ( CT == CFE_TPOSELAST ) || ( CT == CFE_LIEHR ) || ( CT == CFE_CDWI_TPOS ) || ( CT == CFE_CDWI_LIEHR ) ) {
      this->detectVirtualNodes();
      this->initVirtualNodes ( nodalCoeff );
    } else {
      throw aol::Exception ( "tpcfe::CFEGridBase::detectAndInitVirtualNodes ( nodalCoeff ) is only for CFE_TPOS, CFE_TPOSELAST and CFE_LIEHR mode.", __FILE__, __LINE__ );
    }
  }

template<typename _RealType , tpcfe::ConstraintType _CT, typename NodalCoeffType >
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::detectVirtualNodes (  ) 

Detection of slave and virtual nodes

Definition at line 153 of file tpCFEGrid.cpp.

References tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_verboseMode, tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_vNode, tpcfe::CFETopoElement::cfeType(), tpcfe::CFEElement< RealType >::computeAssembleData(), aol::ProgressBar< _showPercentage, _showBar, TYPE, _screenWidth, _leftBrace, _rightBrace, _empty, _full >::finish(), tpcfe::CFEGridDefinition::getElType(), qc::RectangularGrid< qc::QC_3D >::getNumberOfElements(), tpcfe::CFEElement< RealType >::globalIndex(), tpcfe::NODE_NOT_VIRTUAL, tpcfe::CFEType::representsInterfaced(), and aol::ProgressBar< _showPercentage, _showBar, TYPE, _screenWidth, _leftBrace, _rightBrace, _empty, _full >::start().

Referenced by tpcfe::CFEGrid< _RealType, CFE_CD, _NodalCoeffType >::detectAndInitVirtualNodes(), tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::detectAndInitVirtualNodes(), and qc::IntegrateFunctionOverLevelSetBase3d< RealType, IntegrateFunctionSqrOverLevelSet< RealType, qc::QC_3D > >::IntegrateFunctionOverLevelSetBase3d().

                                                                       {

  aol::ProgressBar<> pb ( "Detecting virtual nodes" );
  pb.start ( this->getNumberOfElements() );

  // Check all elements
  const qc::GridSize<qc::QC_3D> gridSize ( *this );
  for ( FullElementIterator it ( *this ); it.notAtEnd(); ++it ) {
    tpcfe::CFEElement<RealType> el ( *it, gridSize, this->getElType ( *it ) );
    const CFEType type = el.cfeType();

    if ( _verboseMode ) pb++;

    if ( type.representsInterfaced() ) {

      el.computeAssembleData ( *this );

      // Run through tetrahedra and get virtual nodes
      for ( CFETopoTetraIterator it ( type ); it.notAtEnd(); ++it ) {
        for ( short i = 0; i < 4; ++i ) { // Check whether any node of this tetra is virtual
          const short li1 = (*it) ( i, 1 );
          if ( li1 != NODE_NOT_VIRTUAL ) { // This is a virtual node
            // Create virtual node object
            const short li0 = (*it) ( i, 0 );
            const VNIndexType mapIndex = VNType::mapIndex ( el.globalIndex ( li0 ), el.globalIndex ( li1 ) );

            VNMapTypeConstIt vnIt = _vNode.find ( mapIndex );
            if ( vnIt == _vNode.end() ) { // virtual node is new
              VNType *vnode = new VNType ( li0, li1,
                                           el.globalIndex ( li0 ),
                                           el.globalIndex ( li1 ),
                                           el, it->getParent() );
              _vNode[mapIndex] = vnode;

            } else { // virtual node has been found before
              vnIt->second->addInElement ( el, it->getParent() );
            }
          }
        }
      }
    }
  }

  if ( _verboseMode ) {
    pb.finish();
    cerr << "Detected " << _vNode.size() << " virtual nodes " << endl;
  }

}

template<typename _RealType , tpcfe::ConstraintType _CT, typename NodalCoeffType >
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::doRestrictToDomain ( aol::Vector< RealType > &  arg  )  const [protected]
template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::doRestrictToDomain ( aol::MultiVector< RealType > &  arg  )  const [inline, protected]

Definition at line 593 of file tpCFEGrid.h.

                                                                  {
    for ( int i = 0; i < arg.numComponents(); ++i )
      doRestrictToDomain ( arg[i] );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::dump ( ostream &  out  )  const [inline]

Print out the number of structures

Definition at line 636 of file tpCFEGrid.h.

                                    {
    const int num = _structure.size ();
    out << "This grid has " << num << " structure" << ( ( num > 1 ) ? "s." : "." ) << endl;
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
RealType tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getAdjustVirtualNodes (  )  const [inline]

Definition at line 213 of file tpCFEGrid.h.

                                           {
    return ( _adjustVirtualNodes );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
int tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getCfeGridIndexOffset ( const int  i  )  const [inline]
template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
ConstraintType tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getCT (  )  const [inline]

Definition at line 222 of file tpCFEGrid.h.

                                        {
    return ( _CT );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
RealType tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getCutRelationBetween ( const qc::CoordType pos0,
const qc::CoordType pos1,
const signed char  stru 
) const [inline]

Returns cut relation of structure stru between two nodes (given by global index). This only makes sense if the two nodes are connected by an edge (which would be expensive to check).

Definition at line 669 of file tpCFEGrid.h.

Referenced by tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::getCutRelationBetween().

                                                                                                                    {
    return ( getStructureRef ( stru ).getCutRelationBetween ( pos0, pos1 ) );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getCutRelations ( CFEElement< RealType > &  el  )  const
template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
const BitArrayType& tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getDirichletMaskRef (  )  const [inline]

Definition at line 433 of file tpCFEGrid.h.

                                                  {
    if ( !_pDirichletMask ) {
      throw aol::Exception ( "No Dirichlet mask set", __FILE__, __LINE__ );
    }
    return ( ( *_pDirichletMask ) );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
const BitArrayType& tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getDOFMaskRef (  )  const [inline]

Definition at line 440 of file tpCFEGrid.h.

                                            {
    if ( !_pDOFMask ) {
      throw aol::Exception ( "No DOFMask set", __FILE__, __LINE__ );
    }
    return ( ( *_pDOFMask ) );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
const BitArrayType& tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getDomainNodeMaskRef (  )  const [inline]

Get reference to the domain node mask

Definition at line 352 of file tpCFEGrid.h.

                                                   {
    if ( !_pDomainNodeMask ) {
      throw aol::Exception ( "No domain node mask set", __FILE__, __LINE__ );
    }
    return ( ( *_pDomainNodeMask ) );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
const CFEStructure<RealType>& tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getDomainRef (  )  const [inline]

Get Reference to the computational domain

Definition at line 258 of file tpCFEGrid.h.

Referenced by tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::isInsideDomain(), tpcfe::CFEGrid< _RealType, CFE_DOMAIN, _RealType >::setDomainFrom(), and tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setDomainRef().

                                                     {
    if ( _pDomain == NULL ) {
      throw aol::Exception ( "No domain set.", __FILE__, __LINE__ );
    }
    return ( *_pDomain );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
int tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getNumDOFs (  )  const [inline]

Definition at line 656 of file tpCFEGrid.h.

                           {
    // print warning if _pDOFMask not set but _DirichletMask set??
    if ( _pDOFMask == NULL )
      return ( this->getNumberOfNodes() );
    else
      return ( _pDOFMask->numTrue() );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
int tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getNumStructures (  )  const [inline]

Return number of structures (i. e. interfaces for jumping coefficients)

Definition at line 320 of file tpCFEGrid.h.

Referenced by tpcfe::CFEHybridMatrix< CFEGrid< DataType, CFE_LIEHR > >::init().

                                 {
    return ( _structure.size() );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
const CFEStructure<RealType>& tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getStructureRef ( const short  num  )  const [inline]

Return reference to structure identified by number

Definition at line 274 of file tpCFEGrid.h.

Referenced by tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::getCutRelationBetween(), tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::getStructureRefForType(), tpcfe::CFEHybridMatrix< CFEGrid< DataType, CFE_LIEHR > >::init(), tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::isEdgeInterfaced(), and tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::isNearInterface().

                                                                          {
    if ( num == MAX_STRUCT_ID ) {
      if ( _pDomain == NULL ) {
        throw aol::Exception ( "No domain set.", __FILE__, __LINE__ );
      }
      return ( *_pDomain );
    } else {
      if ( num < 0 || num >= MAX_STRUCT_ID ) {
        throw aol::OutOfBoundsException ( "Cannot return this structure", __FILE__, __LINE__ );
      }
      if ( _structure[num] == NULL ) {
        throw aol::Exception ( "Structure not set.", __FILE__, __LINE__ );
      }
      return ( * ( _structure[num] ) );
    }
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
const CFEStructure<RealType>& tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getStructureRefForType ( const CFEType  type  )  const [inline]

Return reference to the structure for the given type (not for index of structure!)

Definition at line 267 of file tpCFEGrid.h.

Referenced by tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::initVirtualNodes().

                                                                                    {
    const short structureNo = type._structureNo;
    return ( getStructureRef ( structureNo ) );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getStructureValues ( const CFEStructure< RealType > &  s,
CFEElement< RealType > &  el 
) const [inline, protected]

Fill the element with structure values of the structure s at its vertices

Definition at line 723 of file tpCFEGrid.h.

                                                                                              {
    for ( int i = 0; i < 8; ++i )
      el.setStructureValue ( i, s.getValue ( el + CFETopoLookup::_hexNbOffsets[i] ) );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getStructureValues ( CFEElement< RealType > &  el  )  const

Fill the element with appropriate structure values at its vertices

Referenced by tpcfe::CFEElement< typename GridType::RealType >::computeAssembleData().

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
RealType tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getTotalInnerVolume (  )  const [inline]

Definition at line 650 of file tpCFEGrid.h.

                                         {
    return ( getTotalPartialVolume ( -1 ) );
  }

template<typename _RealType , tpcfe::ConstraintType _CT, typename NodalCoeffType >
_RealType tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getTotalPartialVolume ( const signed char  which  )  const

Definition at line 387 of file tpCFEGrid.cpp.

References tpcfe::CFEType::_pureType, tpcfe::CFETopoElement::cfeType(), tpcfe::CFEElement< RealType >::computeAssembleData(), aol::Cub(), tpcfe::CFEGridDefinition::getElType(), and qc::RectangularGrid< qc::QC_3D >::H().

Referenced by tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::getTotalInnerVolume().

                                                                                                               {
  if ( ( which != 1 ) && ( which != -1 ) )
    throw aol::Exception ( "CFEGridBase::getTotalPartialVolume only works for inner or outer volume", __FILE__, __LINE__ );

  RealType totalVolume = 0;

  const qc::GridSize<qc::QC_3D> gridSize ( *this );
  for ( FullElementIterator it ( *this ); it.notAtEnd(); ++it ) {
    tpcfe::CFEElement<RealType> curEl ( *it, gridSize, this->getElType ( *it ) );
    const CFEType cfeType = curEl.cfeType();

    if ( ( ( cfeType._pureType == 0x00 ) && ( which == +1 ) ) ||  ( ( cfeType._pureType == 0xFF ) && ( which == -1 ) ) ) {
      totalVolume += 1;
    } else if ( ( ( cfeType._pureType == 0x00 ) && ( which == -1 ) ) ||  ( ( cfeType._pureType == 0xFF ) && ( which == +1 ) ) ) {
      // no volume to add
    } else {
      curEl.computeAssembleData ( *this );

      for ( tpcfe::CFETetraInElementIterator<RealType> tit ( curEl, which ); tit.notAtEnd(); ++tit ) {
        totalVolume += tit->getVolume();
      }
    }

  }

  totalVolume *= aol::Cub ( this->H() );

  return ( totalVolume );
}

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
int tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getUniformGridIndexOffset ( int   )  const [inline, private]

Definition at line 693 of file tpCFEGrid.h.

                                                    {
    throw aol::Exception ( "getUniformGridIndexOffset: This function must not be used for tpCFE grids" , __FILE__, __LINE__ );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
VNType& tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getVirtualNodeRef ( const int  gIdx0,
const int  gIdx1 
) [inline]

Definition at line 196 of file tpCFEGrid.h.

                                                                 {
    typename VNType::IndexType hashIdx = VNType::mapIndex ( gIdx0, gIdx1 );

    typename VNMapType::const_iterator vnIt = _vNode.find ( hashIdx );

    if ( vnIt == _vNode.end() ) {
      throw aol::Exception ( "Virtual node not found", __FILE__, __LINE__ );
    }

    return ( * ( vnIt->second ) );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
const VNType& tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getVirtualNodeRef ( const int  gIdx0,
const int  gIdx1 
) const [inline]

Return Reference to the virtual node from the map which is interpolated by the given global dofs

Definition at line 183 of file tpCFEGrid.h.

                                                                             {
    const typename VNType::IndexType hashIdx = VNType::mapIndex ( gIdx0, gIdx1 );

    typename VNMapType::const_iterator vnIt = _vNode.find ( hashIdx );

    if ( vnIt == _vNode.end() ) {
      throw aol::Exception ( "Virtual node not found", __FILE__, __LINE__ );
    }

    return ( * ( vnIt->second ) );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::hasDirichletMask (  )  const [inline]

Definition at line 427 of file tpCFEGrid.h.

{ return ( _pDirichletMask != NULL ); }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::hasDOFMask (  )  const [inline]

Definition at line 431 of file tpCFEGrid.h.

{ return ( _pDOFMask != NULL ); }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::hasDomain (  )  const [inline]

Check whether a domain is in use or not

Definition at line 316 of file tpCFEGrid.h.

{ return ( _pDomain != NULL ); }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::hasDomainNodeMask (  )  const [inline]

Definition at line 429 of file tpCFEGrid.h.

{ return ( _pDomainNodeMask != NULL ); }

template<typename _RealType , tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::initVirtualNodes ( const qc::AArray< NodalCoeffType, qc::QC_3D > &  nodalCoeff  )  [protected]

Performs the initialization of weights and constrains of virtual nodes

Definition at line 204 of file tpCFEGrid.cpp.

References tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_verboseMode, tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_virtualNodesInitialized, tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_vNode, tpcfe::CFE_DOMAIN, tpcfe::CFETopoElement::cfeType(), tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::CT, aol::ProgressBar< _showPercentage, _showBar, TYPE, _screenWidth, _leftBrace, _rightBrace, _empty, _full >::finish(), tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getStructureRefForType(), and aol::ProgressBar< _showPercentage, _showBar, TYPE, _screenWidth, _leftBrace, _rightBrace, _empty, _full >::start().

Referenced by tpcfe::CFEGrid< _RealType, CFE_CD, _NodalCoeffType >::detectAndInitVirtualNodes(), and tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::detectAndInitVirtualNodes().

                                                                                                                           {

  aol::ProgressBar<> pb ( "Computing weights" );
  pb.start ( _vNode.size() );

  uint64_t mem = 0;
  for ( VNMapTypeConstIt vnIt = _vNode.begin(); vnIt != _vNode.end(); ++vnIt ) {
    VNType                       &vn = * ( vnIt->second );
    const CFETopoElement         &el = vn.getInElement();
    const CFEStructure<RealType> &s = getStructureRefForType ( el.cfeType() );

    if ( CT != CFE_DOMAIN ) vn.determineApproximateNormal ( s );
#ifdef VERBOSE
    int gIdx0, gIdx1;
    vn.splitIndex ( vnIt->first, gIdx0, gIdx1 );
    cerr << "determining constraints for " << vnIt->first << ": " << gIdx0 << " " << gIdx1 << " in element " << el << endl;
#endif
    vn.determineConstraints ( nodalCoeff, *this );

    mem += vn.memoryUsed();
    mem += sizeof ( VNIndexType );
    mem += sizeof ( VNType* );

    if ( _verboseMode ) pb++;
  }

  if ( _verboseMode ) {
    pb.finish();
    cerr << "   Memory used is " << mem << " bytes = " << ( mem*1.0 / 1048576 ) << " MiB " << endl;
    if ( _vNode.size() ) {
      cerr << "   That is " << mem / _vNode.size() << " bytes = " << ( mem*1.0 / ( 1024*_vNode.size() ) ) << " KiB per node" << endl;
    }
  }
  _virtualNodesInitialized = true;
}

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::interfaced ( const CFEElement< RealType > &  el,
int  parentTetra 
) const [protected]

Tells whether an element is interfaced or not. Please note that it is much faster to query the cfeType of the element than calling this function. For any cfeType other than 0x00 and 0xFF the element is interfaced!

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::isCoarsened (  )  const [inline]
template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::isDirichletNode ( const int  globalIndex  )  const [inline]
template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::isDirichletNode ( const qc::CoordType pos  )  const [inline]

Definition at line 506 of file tpCFEGrid.h.

                                                               {
    if ( CT == CFE_CD || CT == CFE_TPOS || CT == CFE_LIEHR || CT == CFE_CDWI_TPOS || CT == CFE_CDWI_LIEHR || CT == CFE_TPOSELAST ) {
      if ( _pDirichletMask == NULL ) {
        return ( false );
      } else {
        return ( ( _pDirichletMask->get ( pos ) ) );
      }
    } else {
      throw aol::Exception ( "tpcfe::CFEGridBase::isDirichletNode not implemented for CT != CFE_CD, CFE_TPOS, CFE_LIEHR, CFE_CDWI_TPOS, CFE_CDWI_LIEHR, CFE_TPOSELAST.", __FILE__, __LINE__ );
    }
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::isDOFNode ( const int  globalIndex  )  const [inline]

Definition at line 518 of file tpCFEGrid.h.

Referenced by tpcfe::CFEPeriodicHybridMatrix< CFEGrid< DataType, CFE_CD > >::init(), and tpcfe::CFEHybridMatrix< CFEGrid< DataType, CFE_CD, NodalCoeffType > >::init().

                                                        {
    if ( CT == CFE_CD || CT == CFE_CDWI_TPOS || CT == CFE_CDWI_LIEHR ) {
      if ( _pDOFMask == NULL ) {
        this->setDOFMaskFromDirichletAndDomainNodeMask();
      }

      return ( ( _pDOFMask->get ( globalIndex ) ) );

    } else if ( CT == CFE_TPOS || CT == CFE_LIEHR || CT == CFE_TPOSELAST ) {

      return ( !isDirichletNode ( globalIndex ) );

    } else {
      throw aol::Exception ( "tpcfe::CFEGridBase::isDOFNode not implemented for CT != CFE_CD, CFE_TPOS, CFE_LIEHR, CFE_CDWI_TPOS, CFE_CDWI_LIEHR.", __FILE__, __LINE__ );
    }
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::isDOFNode ( const qc::CoordType pos  )  const [inline]

Definition at line 535 of file tpCFEGrid.h.

                                                         {
    if ( CT == CFE_CD || CT == CFE_CDWI_TPOS || CT == CFE_CDWI_LIEHR ) {
      if ( _pDOFMask == NULL ) {
        this->setDOFMaskFromDirichletAndDomainNodeMask();
      }

      return ( ( _pDOFMask->get ( pos ) ) );

    } else if ( CT == CFE_TPOS || CT == CFE_LIEHR || CT == CFE_TPOSELAST ) {

      return ( !isDirichletNode ( pos ) );

    } else {
      throw aol::Exception ( "tpcfe::CFEGridBase::isDOFNode not implemented for CT != CFE_CD, CFE_TPOS, CFE_LIEHR, CFE_CDWI_TPOS, CFE_CDWI_LIEHR.", __FILE__, __LINE__ );
    }
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::isDomainNode ( const qc::CoordType pos  )  const [inline]

Definition at line 479 of file tpCFEGrid.h.

                                                            {
    if ( CT == CFE_CD || CT == CFE_CDWI_TPOS || CT == CFE_CDWI_LIEHR ) {
      if ( _pDomainNodeMask == NULL ) {
        throw aol::Exception ( "tpcfe::CFEGridBase::isDomainNode: no domain node mask set!", __FILE__, __LINE__ );
      }

      return ( _pDomainNodeMask->get ( pos ) );

    } else if ( CT == CFE_LIEHR || CT == CFE_TPOS || CT == CFE_TPOSELAST ) {
      return ( true );
    } else {
      throw aol::Exception ( "tpcfe::CFEGridBase::isDomainNode not implemented for CT != CFE_CD, CFE_TPOS, CFE_LIEHR, CFE_CDWI_TPOS, CFE_CDWI_LIEHR, CFE_TPOSELAST.", __FILE__, __LINE__ );
    }
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::isDomainNode ( const int  globalIndex  )  const [inline]

Definition at line 462 of file tpCFEGrid.h.

Referenced by tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::doRestrictToDomain(), and tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::setDOFMaskFromDirichletAndDomainNodeMask().

                                                           {
    if ( CT == CFE_CD || CT == CFE_CDWI_TPOS || CT == CFE_CDWI_LIEHR ) {
      if ( _pDomainNodeMask == NULL ) {
        throw aol::Exception ( "tpcfe::CFEGridBase::isDomainNode: no domain node mask set!", __FILE__, __LINE__ );
      }

      return ( _pDomainNodeMask->get ( globalIndex ) );

    } else if ( CT == CFE_LIEHR || CT == CFE_TPOS || CT == CFE_TPOSELAST ) {
      return ( true );
    } else {
      // maybe just return true?
      throw aol::Exception ( "tpcfe::CFEGridBase::isDomainNode not implemented for CT != CFE_CD, CFE_TPOS, CFE_LIEHR, CFE_CDWI_TPOS, CFE_CDWI_LIEHR, CFE_TPOSELAST.", __FILE__, __LINE__ );
    }

  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::isEdgeInterfaced ( const qc::CoordType  pos0,
const qc::CoordType  pos1,
const short  stru = 0 
) const [inline]

Return whether the edge between nodes is interfaced by structure.

Definition at line 646 of file tpCFEGrid.h.

                                                                                                       {
    return ( getStructureRef ( stru ).getValue ( pos0 ) * getStructureRef ( stru ).getValue ( pos1 ) < 0 );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::isInnerNode ( const qc::CoordType pos  )  const [inline]

Definition at line 552 of file tpCFEGrid.h.

Referenced by tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::isInnerNode().

                                                           {
    if ( CT == CFE_CD || CT == CFE_CDWI_TPOS || CT == CFE_CDWI_LIEHR ) {
      if ( _pDomain == NULL ) {
        throw aol::Exception ( "tpcfe::CFEGridBase::isInnerNode: no domain set!", __FILE__, __LINE__ );
      }

      return ( _pDomain->getValue ( pos ) < 0.0 );

    } else if ( CT == CFE_TPOS ) {
      return ( true );
    } else {
      throw aol::Exception ( "tpcfe::CFEGridBase::isInnerNode not implemented for CT != CFE_CD, CFE_TPOS, CFE_CDWI_TPOS, CFE_CDWI_LIEHR", __FILE__, __LINE__ );
    }
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::isInnerNode ( const int  globalIndex  )  const [inline]

Definition at line 567 of file tpCFEGrid.h.

                                                          {
    qc::CoordType pos;
    getIndexMapperRef().splitGlobalIndex ( globalIndex, pos );
    return ( isInnerNode ( pos ) );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::isInsideDomain ( const qc::CoordType pos  )  const [inline]
template<typename _RealType , tpcfe::ConstraintType _CT, typename NodalCoeffType >
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::isInterfaced ( const CFEElement< RealType > &  e  )  const

Return whether an elemnt has type > 0 or not

Definition at line 99 of file tpCFEGrid.cpp.

Referenced by qc::IntegrateFunctionOverLevelSetBase3d< RealType, IntegrateFunctionSqrOverLevelSet< RealType, qc::QC_3D > >::integrateBall().

                                                                                                           {
  const int index = e.globalIndex ();
  return ( _elType[index].representsInterfaced() );
}

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::isNearInterface ( const qc::CoordType pos,
const short  struc = 0 
) const [inline]

for CFE_TPOS, determine whether any of the 15 neighbors lies on the other side of interface struc (maybe check all?)

Definition at line 575 of file tpCFEGrid.h.

                                                                               {
    if ( CT != CFE_TPOS && CT != CFE_TPOSELAST ) {
      throw aol::Exception ( "tpcfe::CFEGridBase::isNearInterface not implemented for CT != CFE_TPOS", __FILE__, __LINE__ );
    }
    const RealType hereVal = getStructureRef ( struc ).getValue ( pos );
    for ( short nb = 0; nb < NUM_NEIGHBORS /* sic: CFE_CD neighbors only! */; ++nb ) {
      const qc::CoordType nbpos = pos + CFETopoLookup::_tetNbOffsets[nb];
      if ( this->isAdmissibleNode ( nbpos ) && getStructureRef ( struc ).getValue ( nbpos  ) * hereVal < 0 ) { // has opposite sign
        return ( true );
      }
    }
    return ( false );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
CFEGridBase<_RealType, _CT, NodalCoeffType >& tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::operator= ( const CFEGridBase< _RealType, _CT, NodalCoeffType > &   )  [private]
template<typename _RealType , tpcfe::ConstraintType _CT, typename NodalCoeffType>
_RealType tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::relaxedDetectAndInitVirtualNodes ( const qc::AArray< NodalCoeffType, qc::QC_3D > &  nodalCoeff,
const RealType  initThreshold,
const RealType  thresholdStep 
)

Try to detect and initialize virtual nodes with initial maximal inversion error threshold in local construction, increasing the threshold until initialization was successful.

Definition at line 80 of file tpCFEGrid.cpp.

References aol::Exception::dump().

                                                                                                                                                                                                             {
  VNType::_maximalInversionError = initThreshold;
  bool initialized = false;
  while ( !initialized ) {
    try {
      detectAndInitVirtualNodes ( nodalCoeff );
      initialized = true;
    } catch ( aol::Exception &ex ) {
      ex.dump();
      removeVirtualNodes();
      VNType::_maximalInversionError += thresholdStep;
      cerr << "retrying with VNType::_maximalInversionError = " << VNType::_maximalInversionError << endl;
    }
  }
  return ( VNType::_maximalInversionError );
}

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::removeDomain (  )  [inline]
template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::removeStructure ( const int  which  )  [inline]

Remove a structure from the grid. This modifies the indices of other structures. Untested.

Definition at line 302 of file tpCFEGrid.h.

                                           {
    cerr << "CFEGridBase::removeStructure has not been tested (remove this output if it has been tested)." << endl;
    if ( which >= static_cast<int> ( _structure.size() ) ) {
      throw aol::Exception ( "Cannot remove structure. Structure does not exist." );
    }

    removeStructureFromElTypes ( which );

    // Remove pointer to structure object from _structure vector
    _structure.erase ( _structure.begin() + which );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::removeStructureFromElTypes ( const signed char  which  )  [inline, protected]

adjust the element types if a struture has been removed

Definition at line 708 of file tpCFEGrid.h.

Referenced by tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::removeDomain(), and tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::removeStructure().

                                                              {
    /*  int          adjustCounter = 0; */
    /*  CFEStructure<RealType> *s = ( which == MAX_STRUCT_ID ? _pDomain : _structure[which] ); */

    // Remove all element type <> 0 that have been caused by this structure
    for ( unsigned int i = 0; i < _elType.size(); ++i ) {
      const signed char sno = _elType[i]._structureNo;
      if ( sno == which ) {
        _elType[i] = CFEType();
      }
    }
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::removeVirtualNodes (  )  [inline]

Definition at line 673 of file tpCFEGrid.h.

                              {
    for ( VNMapTypeIt it = _vNode.begin(); it != _vNode.end(); ++it ) {
      delete ( ( *it ).second );
    }
    _vNode.clear();
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::restrictDirichletNodes ( aol::Vector< RealType > &  arg  )  const

Sets all entries of arg at Dirichlet nodes to zero.

Referenced by tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::restrictDirichletNodes().

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::restrictDirichletNodes ( aol::MultiVector< RealType > &  arg  )  const [inline]

Definition at line 605 of file tpCFEGrid.h.

                                                                      {
    for ( int i = 0; i < arg.numComponents(); ++i )
      restrictDirichletNodes ( arg[i] );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::restrictToDofs ( aol::Vector< RealType > &  arg  )  const

Sets all entries of arg at non-dofs to zero (outside of domain of computation and Dirichlet nodes).

Referenced by tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::restrictToDofs().

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::restrictToDofs ( aol::MultiVector< RealType > &  arg  )  const [inline]

Definition at line 615 of file tpCFEGrid.h.

                                                              {
    for ( int i = 0; i < arg.numComponents(); ++i )
      restrictToDofs ( arg[i] );
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::restrictToInnerNodes ( qc::ScalarArray< RealType, qc::QC_3D > &  arg  )  const
template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setAdjustLevelset ( const RealType  AdjustLevelset  )  [inline]
template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setAdjustVirtualNodes ( const RealType  AdjustVirtualNodes  )  [inline]

Definition at line 209 of file tpCFEGrid.h.

                                                                   {
    _adjustVirtualNodes = AdjustVirtualNodes;
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setCoarsenedFlag ( const bool  isCo  )  [inline]

For grids not on the finest level, a different matrix structure may be necessary.

Definition at line 681 of file tpCFEGrid.h.

                                            {
    _isCoarsened = isCo;
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setDirichletMask ( BitArrayType dmask  )  [inline]

Definition at line 378 of file tpCFEGrid.h.

                                                {
    if ( &dmask == _pDirichletMask ) {
      throw aol::Exception ( "tpcfe::CFEGridBase::setDirichletMask: cannot set _pDirichletMask to itself", __FILE__, __LINE__ );
      // maybe just do nothing - but I'm not sure whether that's what we want.
    }

    if ( _pDirichletMask ) {
      delete ( _pDirichletMask );
    }
    _pDirichletMask = new BitArrayType ( dmask ); // deep copy
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setDOFMask ( BitArrayType dmask  )  [inline]

Definition at line 390 of file tpCFEGrid.h.

                                          {
    if ( &dmask == _pDOFMask ) {
      throw aol::Exception ( "tpcfe::CFEGridBase::setDOFMask: cannot set _pDOFMask to itself", __FILE__, __LINE__ );
      // maybe just do nothing - but I'm not sure whether that's what we want.
    }

    if ( _pDOFMask ) {
      delete ( _pDOFMask );
    }
    _pDOFMask = new BitArrayType ( dmask ); // deep copy
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setDOFMaskFromDirichletAndDomainNodeMask (  )  const [inline]

this function is not called automatically after domainNodeMask or DirichletMask is set, but if isDOFNode requires DOF mask to be set. all non-Dirichlet domain nodes are set to be DOFs

Definition at line 404 of file tpCFEGrid.h.

Referenced by tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::isDOFNode().

                                                         { // possibly called from isDOFNode -> must be const -> _pDOFMask must be mutable
    if ( _pDOFMask ) {
      delete ( _pDOFMask );
    }

    _pDOFMask = new BitArrayType ( *this );
    for ( int i = 0; i < this->getNumberOfNodes(); ++i ) {
      _pDOFMask->set ( i, ( this->isDomainNode ( i ) && ! ( this->isDirichletNode ( i ) ) ) );
    }
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setDOFMaskFromDirichletMask (  )  const [inline]

Definition at line 415 of file tpCFEGrid.h.

                                             {
    if ( _pDOFMask ) {
      delete ( _pDOFMask );
    }

    _pDOFMask = new BitArrayType ( *this );
    for ( int i = 0; i < this->getNumberOfNodes(); ++i ) {
      _pDOFMask->set ( i, ! ( this->isDirichletNode ( i ) ) );
    }

  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setDomainNodeMask ( BitArrayType dmask  )  [inline]

this function only sets the domainNode mask but does not initialize any virtual nodes or things like that.

Definition at line 366 of file tpCFEGrid.h.

                                                 {
    if ( &dmask == _pDomainNodeMask ) {
      throw aol::Exception ( "tpcfe::CFEGridBase::setDomainNodeMask: cannot set _pDomainNodeMask to itself", __FILE__, __LINE__ );
      // maybe just do nothing - but I'm not sure whether that's what we want.
    }

    if ( _pDomainNodeMask ) {
      delete ( _pDomainNodeMask );
    }
    _pDomainNodeMask = new BitArrayType ( dmask ); // deep copy
  }

template<typename _RealType , tpcfe::ConstraintType _CT, typename NodalCoeffType >
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setDomainRef ( tpcfe::CFEStructure< RealType > &  Domain,
const bool  deleteDomain 
) [protected]

Definition at line 241 of file tpCFEGrid.cpp.

References tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_deleteStructures, tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_pDomain, tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_pDomainNodeMask, tpcfe::CFETopoLookup::_tetNbOffsets, tpcfe::CFE_CD, tpcfe::CFE_CDWI_LIEHR, tpcfe::CFE_CDWI_TPOS, tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::CT, tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::getDomainRef(), qc::GridStructure::isAdmissibleNode(), tpcfe::MAX_STRUCT_ID, tpcfe::NUM_NEIGHBORS, tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::removeDomain(), qc::BitArray< qc::QC_3D >::set(), aol::BitVector::set(), aol::BitVector::setAll(), and tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setElTypes().

                                                                                                                                {
  if ( CT != CFE_CD && CT != CFE_CDWI_TPOS && CT != CFE_CDWI_LIEHR )
    throw aol::Exception ( "CFEGridBase::setDomainRef called for illegal constraint type", __FILE__, __LINE__ );

  this->removeDomain();

  _pDomain = &Domain;
  _deleteStructures.set ( MAX_STRUCT_ID, deleteDomain );

  setElTypes ( MAX_STRUCT_ID );

  if ( _pDomainNodeMask )
    delete ( _pDomainNodeMask );

  _pDomainNodeMask = new BitArrayType ( *this );
  _pDomainNodeMask->setAll ( false );

  for ( qc::RectangularIterator<qc::QC_3D> rit ( *this ); rit.notAtEnd(); ++rit ) {
    if ( getDomainRef().getValue ( *rit ) < 0 ) {
      for ( int l = 0; l < NUM_NEIGHBORS; ++l ) {
        const qc::CoordType nbpos = ( *rit ) + CFETopoLookup::_tetNbOffsets[l];
        if ( this->isAdmissibleNode ( nbpos ) ) {
          _pDomainNodeMask->set ( nbpos, true );
        }
      }
    }
  }
}

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setDomainRef ( tpcfe::CFEStructure< RealType > &  Domain  )  [inline]

Set reference to the computational domain (not copied) For the CFE_DOMAIN mode this method also computes the remapping of standard degrees of freedom

Attention:
Changing the Structure afterwards may not have the desired effects on the grid.

Definition at line 230 of file tpCFEGrid.h.

Referenced by tpcfe::CFEGrid< _RealType, CFE_CD, _NodalCoeffType >::setDomainFrom(), tpcfe::CFEGrid< _RealType, CFE_CDWI_TPOS, _RealType >::setDomainFrom(), tpcfe::CFEGrid< _RealType, CFE_CDWI_LIEHR, _RealType >::setDomainFrom(), and tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::setDomainRef().

                                                            {
    setDomainRef ( Domain, false );
  }

template<typename _RealType , tpcfe::ConstraintType _CT, typename NodalCoeffType >
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setElTypes ( int  structureNo  )  [protected]

Must be called whenever a structure has been added

Definition at line 106 of file tpCFEGrid.cpp.

References tpcfe::CFETopoLookup::_admissibleSignature, tpcfe::CFETopoLookup::_hexNbOffsets, tpcfe::CFEType::_pureType, tpcfe::CFEType::_structureNo, tpcfe::CFEStructure< RealType >::getValue(), tpcfe::CFEElement< RealType >::globalIndex(), tpcfe::MAX_STRUCT_ID, and tpcfe::CFEType::representsInterfaced().

Referenced by tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::addStructureRef(), tpcfe::CFEGrid< _RealType, CFE_DOMAIN, _RealType >::setDomainFrom(), tpcfe::CFEGrid< _RealType, CFE_NONE, _RealType >::setDomainFrom(), and tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setDomainRef().

                                                                                  {
  CFEStructure<RealType> *s = ( structureNo == MAX_STRUCT_ID ? _pDomain : _structure[structureNo] );

  const qc::GridSize<qc::QC_3D> gridSize ( *this );
  for ( FullElementIterator it ( *this ); it.notAtEnd(); ++it ) {
    tpcfe::CFEElement<RealType> curEl ( *it, gridSize, this->getElType ( *it ) );

    CFEType tempType;
    unsigned char  bitMask = 1;
    const int globalIndex = curEl.globalIndex();

    for ( int i = 0; i < 8; ++i ) {                   // Run through all nodes of element
      const qc::CoordType epos = *it + CFETopoLookup::_hexNbOffsets[i];
      const RealType p = s->getValue ( epos );
      if ( p < 0 ) tempType._pureType |= bitMask;
      bitMask <<= 1;
    }

    if ( tempType.representsInterfaced() ) { // this is necessary because an element can be non-interfaced by more than one structure
      tempType._structureNo = structureNo;
    }

    // An element is interfaced by more than one structure if the element is interfaced by another structure
    // and the element is interfaced by the new structure.
    if ( _elType[globalIndex].representsInterfaced() && tempType.representsInterfaced() ) {
      throw aol::Exception ( "CFEGridBase::setElTypes: This element is interfaced by more than one structure!", __FILE__, __LINE__ );
    } else {
      //     } else if ( CFETopoLookup::_admissibleSignature [ tempType._pureType ] == false ) {
      if ( ( CFETopoLookup::_admissibleSignature [ tempType._pureType ] == false ) && ( _inadmissibleSignatureWarningPrinted == false ) ) {
        cerr << "CFEGridBase::setElTypes: Element " << *it << " is interfaced more than once by the interface. Signature is " << static_cast<short>( tempType._pureType ) << endl;
        cerr << "Currently not throwing exception. This warning will not be printed again." << endl;
        _inadmissibleSignatureWarningPrinted = true;
      // throw aol::Exception ( "CFEGridBase::setElTypes: This element is interfaced more than once by the interface!", __FILE__, __LINE__ );
      }

      // The type of the element needs an update if the element is interfaced by the structure or the structure is a domain.
      // (later the type is used to specify whether an element is in a domain or not)
      if ( ( tempType._pureType != 0 ) || structureNo == MAX_STRUCT_ID ) {
        _elType[ globalIndex ] = tempType;
      }
    }

  }

}

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setInnerNodeMask ( qc::BitArray< qc::QC_3D > &  innerNodes  )  const [inline]

set all entries of the given BitArray<qc::QC_3D> to true where levelset function has negative values

Definition at line 448 of file tpCFEGrid.h.

                                                                  {
    if ( innerNodes.size() != this->getNumberOfNodes() ) {
      throw aol::Exception ( "tpcfe::CFEGridBase::setInnerNodeMask: incorrect size of BitArray", __FILE__, __LINE__ );
    }
    if ( _pDomain == NULL ) {
      throw aol::Exception ( "No domain set.", __FILE__, __LINE__ );
    }

    for ( qc::RectangularIterator<qc::QC_3D> bit ( *this ); bit.notAtEnd(); ++bit ) {
      innerNodes.set ( *bit, ( _pDomain->getValue ( *bit ) < 0 ) ); // check for non-NULLness
    }

  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
void tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setVerboseMode ( const bool  whichMode  )  [inline]

Definition at line 170 of file tpCFEGrid.h.

Referenced by tpcfe::CFETester::CFELocalAssemblyTesterLIEHR().

                                               {
    _verboseMode = whichMode;
  }

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
const VNMapType& tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::virtualNodeMapRef (  )  const [inline]

Return reference to the map of virtual nodes

Definition at line 176 of file tpCFEGrid.h.

                                             {
    return ( _vNode );
  }


Member Data Documentation

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
RealType tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_adjustVirtualNodes [protected]

If virtual node is closer to regular grid point than this value times the grid width, it is moved away from the regular grid point.

Definition at line 151 of file tpCFEGrid.h.

Referenced by tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::getAdjustVirtualNodes(), and tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::setAdjustVirtualNodes().

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
aol::BitVector tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_deleteStructures [protected]

here, we may store multiple level set functions describing regions with different coefficients

bookkeeping whether structure should be deleted in destructor or belongs to someone else, MAX_STRUCT_ID refers to domain

Definition at line 126 of file tpCFEGrid.h.

Referenced by tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::addStructureFrom(), tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::removeDomain(), tpcfe::CFEGrid< _RealType, CFE_DOMAIN, _RealType >::setDomainFrom(), tpcfe::CFEGrid< _RealType, CFE_NONE, _RealType >::setDomainFrom(), and tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::setDomainRef().

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_inadmissibleSignatureWarningPrinted

Definition at line 121 of file tpCFEGrid.h.

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_isCoarsened [protected]

Store whether grid was created by multigrid solver and represents coarsened level (i.e. no level set function describing geometry present). This is important for creating appropriate matrices.

Definition at line 154 of file tpCFEGrid.h.

Referenced by tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::isCoarsened(), and tpcfe::CFEGridBase< _RealType, CFE_CDWI_TPOS, _RealType >::setCoarsenedFlag().

template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
BitArrayType* tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_pDirichletMask [protected]
template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_verboseMode [protected]
template<typename _RealType, tpcfe::ConstraintType _CT, typename NodalCoeffType>
bool tpcfe::CFEGridBase< _RealType, _CT, NodalCoeffType >::_virtualNodesInitialized [protected]

The documentation for this class was generated from the following files:

Generated on Fri Sep 9 2011 21:10:05 for QuocMesh by doxygen 1.7.1