ug4
|
Interface for Obstacle Constraints. More...
#include <obstacle_constraint_interface.h>
Classes | |
struct | CondNumberData |
grouping for subset and conditional data More... | |
struct | ConstNumberData |
grouping for subset and conditional data More... | |
struct | NumberData |
grouping for subset and non-conditional data More... | |
struct | VectorData |
grouping for subset and non-conditional data More... | |
Public Types | |
typedef TAlgebra | algebra_type |
Algebra type. More... | |
typedef IDomainConstraint< TDomain, TAlgebra > | base_type |
Base Type. More... | |
typedef TDomain | domain_type |
Type of domain. More... | |
typedef algebra_type::matrix_type | matrix_type |
Matrix type. More... | |
typedef domain_type::position_type | position_type |
Type of position coordinates (e.g. position_type) More... | |
typedef vector_type::value_type | value_type |
Value type. More... | |
typedef algebra_type::vector_type | vector_type |
Vector type. More... | |
Public Types inherited from ug::IDomainConstraint< TDomain, TAlgebra > | |
typedef TAlgebra | algebra_type |
Algebra type. More... | |
typedef TDomain | domain_type |
Domain Type. More... | |
typedef algebra_type::matrix_type | matrix_type |
Type of algebra matrix. More... | |
typedef algebra_type::vector_type | vector_type |
Type of algebra vector. More... | |
Public Types inherited from ug::IConstraint< TAlgebra > | |
typedef TAlgebra | algebra_type |
Algebra type. More... | |
typedef algebra_type::matrix_type | matrix_type |
Type of algebra matrix. More... | |
typedef algebra_type::vector_type | vector_type |
Type of algebra vector. More... | |
Public Member Functions | |
void | active_dofs (vector< DoFIndex > &vActiveDoFs) |
returns the vector storing the active dofs More... | |
void | add (number value, const char *function) |
adds a constant value as dirichlet condition for a function on subsets and on whole domain More... | |
void | add (number value, const char *function, const char *subsets) |
void | add (SmartPtr< UserData< MathVector< dim >, dim > > func, const char *functions) |
adds a user-defined vector as dirichlet condition for a vector-function on subsets and on whole domain More... | |
void | add (SmartPtr< UserData< MathVector< dim >, dim > > func, const char *functions, const char *subsets) |
void | add (SmartPtr< UserData< number, dim > > func, const char *function) |
adds a user-defined value as dirichlet condition for a function on subsets and on whole domain More... | |
void | add (SmartPtr< UserData< number, dim > > func, const char *function, const char *subsets) |
void | add (SmartPtr< UserData< number, dim, bool > > func, const char *function) |
adds a lua callback (cond and non-cond) More... | |
void | add (SmartPtr< UserData< number, dim, bool > > func, const char *function, const char *subsets) |
void | adjust_defect (vector_type &d, const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol=NULL, const std::vector< number > *vScaleMass=NULL, const std::vector< number > *vScaleStiff=NULL) |
sets a zero value in the defect for all dirichlet indices More... | |
virtual void | adjust_defect_to_constraint (vector_type &d)=0 |
the defect needs to be adjusted for the active indices (those indices, which are in contact) More... | |
void | adjust_jacobian (matrix_type &J, const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol=NULL, const number s_a0=1.0) |
sets a unity row for all dirichlet indices More... | |
void | adjust_linear (matrix_type &A, vector_type &b, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0) |
sets unity rows in A and dirichlet values in right-hand side b More... | |
virtual void | adjust_prolongation (matrix_type &P, ConstSmartPtr< DoFDistribution > ddFine, ConstSmartPtr< DoFDistribution > ddCoarse, int type, number time=0.0) |
sets constraints in prolongation More... | |
virtual void | adjust_restriction (matrix_type &R, ConstSmartPtr< DoFDistribution > ddCoarse, ConstSmartPtr< DoFDistribution > ddFine, int type, number time=0.0) |
sets constraints in restriction More... | |
void | adjust_rhs (vector_type &b, const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0) |
sets the dirichlet value in the right-hand side More... | |
virtual void | adjust_sol_and_cor (value_type &sol_i, value_type &c_i, bool &dofIsAdmissible, const DoFIndex &dof)=0 |
projects the i-th index of the solution onto the admissible set and adjusts the correction More... | |
void | adjust_solution (vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0) |
sets the dirichlet value in the solution for all dirichlet indices More... | |
void | init () |
IObstacleConstraint () | |
constructor More... | |
IObstacleConstraint (const GridFunction< TDomain, TAlgebra > &u) | |
constructor for an obstacle defined on some subset(s) More... | |
bool | is_obs_dof (const DoFIndex &dof) |
checks if a given dof is in an obstacle subset More... | |
virtual void | preprocess () |
void | reset_active_dofs () |
resets the vector storing the active dofs More... | |
virtual void | restrict_obs_values ()=0 |
restricts the obstacle values to a coarser grid in a multigrid hierarchy More... | |
virtual int | type () const |
returns the type of the constraints More... | |
virtual | ~IObstacleConstraint () |
Destructor. More... | |
Public Member Functions inherited from ug::IDomainConstraint< TDomain, TAlgebra > | |
SmartPtr< ApproximationSpace< TDomain > > | approximation_space () |
returns approximation space More... | |
ConstSmartPtr< ApproximationSpace< TDomain > > | approximation_space () const |
returns approximation space More... | |
virtual SmartPtr< IErrEstData< TDomain > > | err_est_data () |
returns the pointer to the error estimator data object (or NULL) More... | |
bool | err_est_enabled () const |
find out whether or not a posteriori error estimation is to be performed for this disc More... | |
IDomainConstraint () | |
constructor More... | |
virtual void | set_approximation_space (SmartPtr< ApproximationSpace< TDomain > > approxSpace) |
sets the approximation space More... | |
void | set_ass_tuner (ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssemblingTuner=NULL) |
sets the assemble adapter for the constraints More... | |
void | set_error_estimator (SmartPtr< IErrEstData< TDomain > > ee) |
sets the pointer to an error estimator data object (or NULL) More... | |
Public Member Functions inherited from ug::IConstraint< TAlgebra > | |
virtual void | adjust_correction (vector_type &c, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0) |
virtual void | adjust_error (const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol=SPNULL, const std::vector< number > *vScaleMass=NULL, const std::vector< number > *vScaleStiff=NULL) |
adjusts the assembled error estimator values in the attachments according to the constraint More... | |
virtual void | adjust_linear_residual (vector_type &d, const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0) |
adjust linear residual More... | |
virtual void | adjust_prolongation (vector_type &uFine, GridLevel fineLvl, const vector_type &uCoarse, GridLevel coarseLvl, int type) |
sets the constraints in a solution vector More... | |
virtual void | adjust_restriction (vector_type &uCoarse, GridLevel coarseLvl, const vector_type &uFine, GridLevel fineLvl, int type) |
sets the constraints in a solution vector More... | |
virtual void | modify_solution (SmartPtr< VectorTimeSeries< vector_type > > vSolMod, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, ConstSmartPtr< DoFDistribution > dd, int type) |
modify_solution for instationary case More... | |
virtual void | modify_solution (vector_type &uMod, const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type) |
modifies solution vector before calling the assembling routine More... | |
virtual | ~IConstraint () |
virtual destructor More... | |
Static Public Attributes | |
static const int | dim = domain_type::dim |
world Dimension More... | |
Protected Attributes | |
map< DoFIndex, number > | m_mObstacleValues |
map to store obstacle values with its corresponding DoFs More... | |
vector< DoFIndex > | m_vActiveDofs |
stores the dofs, which satisfy the constraints with equality More... | |
vector< int > | m_vObsSubsets |
stores the subset-indices of the obstacle subsets More... | |
Protected Attributes inherited from ug::IDomainConstraint< TDomain, TAlgebra > | |
SmartPtr< ApproximationSpace< TDomain > > | m_spApproxSpace |
Approximation Space. More... | |
ConstSmartPtr< AssemblingTuner< TAlgebra > > | m_spAssTuner |
Assemble adapter. More... | |
SmartPtr< IErrEstData< TDomain > > | m_spErrEstData |
error estimation object associated to the element discretization More... | |
Private Member Functions | |
void | check_functions_and_subsets (FunctionGroup &functionGroup, SubsetGroup &subsetGroup, size_t numFct) const |
void | clear () |
clear all UserData-member variables More... | |
void | extract_data () |
extract the UserDatas More... | |
template<typename TUserData , typename TScheduledUserData > | |
void | extract_data (std::map< int, std::vector< TUserData * > > &mvUserDataObsSegment, std::vector< TScheduledUserData > &vUserData) |
template<typename TUserData > | |
void | init_obstacle_dofs_with_values (const std::map< int, std::vector< TUserData * > > &mvUserData, number time) |
template<typename TBaseElem , typename TUserData > | |
void | init_obstacle_dofs_with_values (const std::vector< TUserData * > &vUserData, int si, number time) |
void | init_obstacle_dofs_with_values (number time) |
store the obstacle value set by means of UserDatas More... | |
Private Attributes | |
std::map< int, std::vector< CondNumberData * > > | m_mCondNumberObsSegment |
conditional obstacle values for all subsets More... | |
std::map< int, std::vector< ConstNumberData * > > | m_mConstNumberObsSegment |
constant obstacle values for all subsets More... | |
std::map< int, std::vector< NumberData * > > | m_mNumberObsSegment |
non-conditional obstacle values for all subsets More... | |
std::map< int, std::vector< VectorData * > > | m_mVectorObsSegment |
non-conditional obstacle values for all subsets More... | |
ConstSmartPtr< DoFDistribution > | m_spDD |
pointer to the DofDistribution on the whole domain More... | |
ConstSmartPtr< TDomain > | m_spDomain |
pointer to the domain More... | |
std::vector< CondNumberData > | m_vCondNumberData |
std::vector< ConstNumberData > | m_vConstNumberData |
std::vector< NumberData > | m_vNumberData |
std::vector< VectorData > | m_vVectorData |
Additional Inherited Members | |
Protected Member Functions inherited from ug::IDomainConstraint< TDomain, TAlgebra > | |
ConstSmartPtr< DoFDistribution > | dd (const GridLevel &gl) const |
returns the level dof distribution More... | |
Interface for Obstacle Constraints.
The Interface for Obstacle Constraints provides the framework to define obstacle constraints of the form
c(u) <= upObs (cf. 'set_upper_obstacle')
and
c(u) >= lowObs (cf. 'set_lower_obstacle')
where u is the solution vector. Here, 'upObs' and 'lowObs' are user-defined functions, which need to be of the same size as the function of unknowns u. The obstacle function c is defined by creating a derived class of this interface and by specializing the way the correction should be computed (cf. correction_for_lower_obs, correction_for_upper_obs, correction_for_lower_and_upper_obs).
One simple example is the ScalarObstacle-class. Such an obstacle functions can be used in combination with projected preconditioners. They should be passed to the preconditioner by 'IProjPreconditioner::set_obstacle_constraint'.
typedef TAlgebra ug::IObstacleConstraint< TDomain, TAlgebra >::algebra_type |
Algebra type.
typedef IDomainConstraint<TDomain, TAlgebra> ug::IObstacleConstraint< TDomain, TAlgebra >::base_type |
Base Type.
typedef TDomain ug::IObstacleConstraint< TDomain, TAlgebra >::domain_type |
Type of domain.
typedef algebra_type::matrix_type ug::IObstacleConstraint< TDomain, TAlgebra >::matrix_type |
Matrix type.
typedef domain_type::position_type ug::IObstacleConstraint< TDomain, TAlgebra >::position_type |
Type of position coordinates (e.g. position_type)
typedef vector_type::value_type ug::IObstacleConstraint< TDomain, TAlgebra >::value_type |
Value type.
typedef algebra_type::vector_type ug::IObstacleConstraint< TDomain, TAlgebra >::vector_type |
Vector type.
|
inline |
constructor for an obstacle defined on some subset(s)
References ug::GridFunction< TDomain, TAlgebra >::dof_distribution(), and ug::GridFunction< TDomain, TAlgebra >::domain().
|
inline |
constructor
References UG_THROW.
|
inlinevirtual |
Destructor.
|
inline |
returns the vector storing the active dofs
void ug::IObstacleConstraint< TDomain, TAlgebra >::add | ( | number | value, |
const char * | function | ||
) |
adds a constant value as dirichlet condition for a function on subsets and on whole domain
void ug::IObstacleConstraint< TDomain, TAlgebra >::add | ( | number | value, |
const char * | function, | ||
const char * | subsets | ||
) |
void ug::IObstacleConstraint< TDomain, TAlgebra >::add | ( | SmartPtr< UserData< MathVector< dim >, dim > > | func, |
const char * | functions | ||
) |
adds a user-defined vector as dirichlet condition for a vector-function on subsets and on whole domain
References func().
void ug::IObstacleConstraint< TDomain, TAlgebra >::add | ( | SmartPtr< UserData< MathVector< dim >, dim > > | func, |
const char * | functions, | ||
const char * | subsets | ||
) |
References func().
void ug::IObstacleConstraint< TDomain, TAlgebra >::add | ( | SmartPtr< UserData< number, dim > > | func, |
const char * | function | ||
) |
adds a user-defined value as dirichlet condition for a function on subsets and on whole domain
References func().
void ug::IObstacleConstraint< TDomain, TAlgebra >::add | ( | SmartPtr< UserData< number, dim > > | func, |
const char * | function, | ||
const char * | subsets | ||
) |
References func().
void ug::IObstacleConstraint< TDomain, TAlgebra >::add | ( | SmartPtr< UserData< number, dim, bool > > | func, |
const char * | function | ||
) |
adds a lua callback (cond and non-cond)
adds a conditional user-defined value as dirichlet condition for a function on subsets and on whole domain
References func().
void ug::IObstacleConstraint< TDomain, TAlgebra >::add | ( | SmartPtr< UserData< number, dim, bool > > | func, |
const char * | function, | ||
const char * | subsets | ||
) |
References func().
|
inlinevirtual |
sets a zero value in the defect for all dirichlet indices
Implements ug::IConstraint< TAlgebra >.
References UG_LOG.
|
pure virtual |
the defect needs to be adjusted for the active indices (those indices, which are in contact)
Implemented in ug::ScalarUpperObstacle< TDomain, TAlgebra >, ug::ScalarLowerObstacle< TDomain, TAlgebra >, and ug::ObstacleInNormalDir< TDomain, TAlgebra >.
|
inlinevirtual |
sets a unity row for all dirichlet indices
Implements ug::IConstraint< TAlgebra >.
References UG_LOG.
|
inlinevirtual |
sets unity rows in A and dirichlet values in right-hand side b
Implements ug::IConstraint< TAlgebra >.
References UG_LOG.
|
inlinevirtual |
|
virtual |
sets constraints in restriction
Reimplemented from ug::IConstraint< TAlgebra >.
References ug::SetCol(), and UG_LOG.
|
inlinevirtual |
sets the dirichlet value in the right-hand side
Implements ug::IConstraint< TAlgebra >.
References UG_LOG.
|
pure virtual |
projects the i-th index of the solution onto the admissible set and adjusts the correction
Implemented in ug::ScalarUpperObstacle< TDomain, TAlgebra >, ug::ScalarLowerObstacle< TDomain, TAlgebra >, and ug::ObstacleInNormalDir< TDomain, TAlgebra >.
|
inlinevirtual |
sets the dirichlet value in the solution for all dirichlet indices
Implements ug::IConstraint< TAlgebra >.
References UG_LOG.
|
private |
References ug::FunctionGroup::size(), ug::SubsetGroup::size(), and UG_THROW.
|
private |
clear all UserData-member variables
|
private |
extract the UserDatas
|
private |
References ug::SubsetGroup::add_all(), ug::FunctionGroup::size(), UG_CATCH_THROW, and UG_THROW.
void ug::IObstacleConstraint< TDomain, TAlgebra >::init |
|
private |
References ug::EDGE, ug::FACE, UG_CATCH_THROW, ug::VERTEX, and ug::VOLUME.
|
private |
References UG_ASSERT.
|
private |
store the obstacle value set by means of UserDatas
bool ug::IObstacleConstraint< TDomain, TAlgebra >::is_obs_dof | ( | const DoFIndex & | dof | ) |
checks if a given dof is in an obstacle subset
|
inlinevirtual |
this preprocess-method is called in every init-call of the underlying proj. preconditioner it is useful to attach e.g. additional data to the obstacle DoFs, like the e.g. the normal vector at this DoF
Reimplemented in ug::ObstacleInNormalDir< TDomain, TAlgebra >.
|
inline |
resets the vector storing the active dofs
|
pure virtual |
restricts the obstacle values to a coarser grid in a multigrid hierarchy
Implemented in ug::ScalarUpperObstacle< TDomain, TAlgebra >, ug::ScalarLowerObstacle< TDomain, TAlgebra >, and ug::ObstacleInNormalDir< TDomain, TAlgebra >.
|
inlinevirtual |
returns the type of the constraints
Implements ug::IDomainConstraint< TDomain, TAlgebra >.
References ug::CT_CONSTRAINTS.
|
static |
world Dimension
|
private |
conditional obstacle values for all subsets
|
private |
constant obstacle values for all subsets
|
private |
non-conditional obstacle values for all subsets
|
protected |
map to store obstacle values with its corresponding DoFs
|
private |
non-conditional obstacle values for all subsets
|
private |
pointer to the DofDistribution on the whole domain
|
private |
pointer to the domain
|
protected |
stores the dofs, which satisfy the constraints with equality
|
private |
|
private |
|
private |
|
protected |
stores the subset-indices of the obstacle subsets
|
private |