33 #ifndef __H__UG__LIB_ALGEBRA__OPERATOR__PRECONDITIONER__PROJECTED_GAUSS_SEIDEL__OBSTACLE_CONSTRAINT_INTERFACE__
34 #define __H__UG__LIB_ALGEBRA__OPERATOR__PRECONDITIONER__PROJECTED_GAUSS_SEIDEL__OBSTACLE_CONSTRAINT_INTERFACE__
67 template <
typename TDomain,
typename TAlgebra>
112 UG_THROW(
"In 'IObstacleConstraint()': A constructor with a GridFunction as parameter"
118 void add(
const char*
name,
const char*
function);
119 void add(
const char*
name,
const char*
function,
const char* subsets);
131 void add(
number value,
const char*
function);
132 void add(
number value,
const char*
function,
const char* subsets);
144 bool is_obs_dof(
const DoFIndex& dof);
151 {vActiveDoFs = m_vActiveDofs;}
184 UG_LOG(
"IObstacleConstraint::adjust_jacobian() \n");
191 const std::vector<number>* vScaleMass = NULL,
192 const std::vector<number>* vScaleStiff = NULL){
193 UG_LOG(
"IObstacleConstraint::adjust_defect() \n");
199 UG_LOG(
"IObstacleConstraint::adjust_solution() \n");
205 UG_LOG(
"IObstacleConstraint::adjust_linear() \n");
211 UG_LOG(
"IObstacleConstraint::adjust_rhs() \n");
220 UG_LOG(
"IObstacleConstraint::adjust_prolongationP() \n");
238 template <
typename TUserData,
typename TScheduledUserData>
239 void extract_data(std::map<
int, std::vector<TUserData*> >& mvUserDataObsSegment,
240 std::vector<TScheduledUserData>& vUserData);
246 size_t numFct)
const;
249 void init_obstacle_dofs_with_values(
number time);
251 template <
typename TUserData>
252 void init_obstacle_dofs_with_values(
const std::map<
int, std::vector<TUserData*> >& mvUserData,
number time);
254 template <
typename TBaseElem,
typename TUserData>
255 void init_obstacle_dofs_with_values(
const std::vector<TUserData*>& vUserData,
int si,
number time);
277 const static bool isConditional =
false;
278 const static size_t numFct = 1;
281 std::string fctName_)
282 : spFunctor(functor_), fctName(fctName_), bWholeDomain(true)
285 std::string fctName_, std::string ssName_)
286 : spFunctor(functor_), fctName(fctName_), ssName(ssName_),
290 number time,
int si)
const
292 (*spFunctor)(val[0], x, time, si);
return true;
306 const static bool isConditional =
true;
307 const static size_t numFct = 1;
310 std::string fctName_)
311 : spFunctor(functor_), fctName(fctName_), bWholeDomain(true)
314 std::string fctName_, std::string ssName_)
315 : spFunctor(functor_), fctName(fctName_), ssName(ssName_),
319 number time,
int si)
const
321 return (*spFunctor)(val[0], x, time, si);
335 const static bool isConditional =
false;
336 const static size_t numFct = 1;
339 std::string fctName_)
340 : functor(value_), fctName(fctName_), bWholeDomain(true)
343 std::string fctName_, std::string ssName_)
344 : functor(value_), fctName(fctName_), ssName(ssName_),
348 number time,
int si)
const
350 val[0] = functor;
return true;
364 const static bool isConditional =
false;
365 const static size_t numFct =
dim;
368 std::string fctName_)
369 : spFunctor(value_), fctName(fctName_), bWholeDomain(true)
372 std::string fctName_, std::string ssName_)
373 : spFunctor(value_), fctName(fctName_), ssName(ssName_),
377 number time,
int si)
const
379 (*spFunctor)(val, x, time, si);
return true;
location name
Definition: checkpoint_util.lua:128
Definition: smart_pointer.h:296
Definition: smart_pointer.h:108
Definition: function_group.h:52
represents numerical solutions on a grid using an algebraic vector
Definition: grid_function.h:121
SmartPtr< TDomain > domain()
returns domain
Definition: grid_function.h:342
SmartPtr< DoFDistribution > dof_distribution()
Definition: grid_function.h:236
Definition: constraint_interface.h:162
Interface for Obstacle Constraints.
Definition: obstacle_constraint_interface.h:73
virtual void adjust_prolongation(matrix_type &P, ConstSmartPtr< DoFDistribution > ddFine, ConstSmartPtr< DoFDistribution > ddCoarse, int type, number time=0.0)
sets constraints in prolongation
Definition: obstacle_constraint_interface.h:215
IObstacleConstraint()
constructor
Definition: obstacle_constraint_interface.h:110
virtual void preprocess()
Definition: obstacle_constraint_interface.h:157
IObstacleConstraint(const GridFunction< TDomain, TAlgebra > &u)
constructor for an obstacle defined on some subset(s)
Definition: obstacle_constraint_interface.h:101
std::map< int, std::vector< VectorData * > > m_mVectorObsSegment
non-conditional obstacle values for all subsets
Definition: obstacle_constraint_interface.h:406
ConstSmartPtr< DoFDistribution > m_spDD
pointer to the DofDistribution on the whole domain
Definition: obstacle_constraint_interface.h:272
std::map< int, std::vector< ConstNumberData * > > m_mConstNumberObsSegment
constant obstacle values for all subsets
Definition: obstacle_constraint_interface.h:400
vector_type::value_type value_type
Value type.
Definition: obstacle_constraint_interface.h:88
ConstSmartPtr< TDomain > m_spDomain
pointer to the domain
Definition: obstacle_constraint_interface.h:269
TDomain domain_type
Type of domain.
Definition: obstacle_constraint_interface.h:91
TAlgebra algebra_type
Algebra type.
Definition: obstacle_constraint_interface.h:79
map< DoFIndex, number > m_mObstacleValues
map to store obstacle values with its corresponding DoFs
Definition: obstacle_constraint_interface.h:259
vector< int > m_vObsSubsets
stores the subset-indices of the obstacle subsets
Definition: obstacle_constraint_interface.h:262
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
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
Definition: obstacle_constraint_interface.h:188
virtual void restrict_obs_values()=0
restricts the obstacle values to a coarser grid in a multigrid hierarchy
std::vector< NumberData > m_vNumberData
Definition: obstacle_constraint_interface.h:391
std::vector< CondNumberData > m_vCondNumberData
Definition: obstacle_constraint_interface.h:390
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
Definition: obstacle_constraint_interface.h:180
virtual int type() const
returns the type of the constraints
Definition: obstacle_constraint_interface.h:232
std::map< int, std::vector< CondNumberData * > > m_mCondNumberObsSegment
conditional obstacle values for all subsets
Definition: obstacle_constraint_interface.h:403
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
Definition: obstacle_constraint_interface.h:197
virtual ~IObstacleConstraint()
Destructor.
Definition: obstacle_constraint_interface.h:172
vector< DoFIndex > m_vActiveDofs
stores the dofs, which satisfy the constraints with equality
Definition: obstacle_constraint_interface.h:265
IDomainConstraint< TDomain, TAlgebra > base_type
Base Type.
Definition: obstacle_constraint_interface.h:76
std::vector< VectorData > m_vVectorData
Definition: obstacle_constraint_interface.h:394
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
Definition: obstacle_constraint_interface.h:209
std::map< int, std::vector< NumberData * > > m_mNumberObsSegment
non-conditional obstacle values for all subsets
Definition: obstacle_constraint_interface.h:397
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)
std::vector< ConstNumberData > m_vConstNumberData
Definition: obstacle_constraint_interface.h:392
void active_dofs(vector< DoFIndex > &vActiveDoFs)
returns the vector storing the active dofs
Definition: obstacle_constraint_interface.h:150
algebra_type::matrix_type matrix_type
Matrix type.
Definition: obstacle_constraint_interface.h:82
domain_type::position_type position_type
Type of position coordinates (e.g. position_type)
Definition: obstacle_constraint_interface.h:97
algebra_type::vector_type vector_type
Vector type.
Definition: obstacle_constraint_interface.h:85
void reset_active_dofs()
resets the vector storing the active dofs
Definition: obstacle_constraint_interface.h:147
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
Definition: obstacle_constraint_interface.h:203
Definition: multi_index.h:50
Wrapper for sequential matrices to handle them in parallel.
Definition: parallel_matrix.h:65
Group of subsets.
Definition: subset_group.h:51
time series of solutions and corresponding time point
Definition: solution_time_series.h:59
#define UG_THROW(msg)
Definition: error.h:57
#define UG_LOG(msg)
Definition: log.h:367
double number
Definition: types.h:124
Definition: smart_pointer.h:814
@ CT_CONSTRAINTS
Definition: ass_tuner.h:58
function func(x, y, z, t, si)
T value_type
Definition: sparsematrix_interface.h:2
grouping for subset and conditional data
Definition: obstacle_constraint_interface.h:305
CondNumberData(SmartPtr< UserData< number, dim, bool > > functor_, std::string fctName_)
Definition: obstacle_constraint_interface.h:309
SmartPtr< UserData< number, dim, bool > > spFunctor
Definition: obstacle_constraint_interface.h:324
SubsetGroup ssGrp
Definition: obstacle_constraint_interface.h:328
std::string ssName
Definition: obstacle_constraint_interface.h:326
bool bWholeDomain
Definition: obstacle_constraint_interface.h:329
CondNumberData(SmartPtr< UserData< number, dim, bool > > functor_, std::string fctName_, std::string ssName_)
Definition: obstacle_constraint_interface.h:313
bool operator()(MathVector< 1 > &val, const MathVector< dim > x, number time, int si) const
Definition: obstacle_constraint_interface.h:318
std::string fctName
Definition: obstacle_constraint_interface.h:325
MathVector< 1 > value_type
Definition: obstacle_constraint_interface.h:308
grouping for subset and conditional data
Definition: obstacle_constraint_interface.h:334
bool bWholeDomain
Definition: obstacle_constraint_interface.h:358
ConstNumberData(number value_, std::string fctName_, std::string ssName_)
Definition: obstacle_constraint_interface.h:342
std::string fctName
Definition: obstacle_constraint_interface.h:354
MathVector< 1 > value_type
Definition: obstacle_constraint_interface.h:337
ConstNumberData(number value_, std::string fctName_)
Definition: obstacle_constraint_interface.h:338
SubsetGroup ssGrp
Definition: obstacle_constraint_interface.h:357
bool operator()(MathVector< 1 > &val, const MathVector< dim > x, number time, int si) const
Definition: obstacle_constraint_interface.h:347
std::string ssName
Definition: obstacle_constraint_interface.h:355
number functor
Definition: obstacle_constraint_interface.h:353
grouping for subset and non-conditional data
Definition: obstacle_constraint_interface.h:276
MathVector< 1 > value_type
Definition: obstacle_constraint_interface.h:279
bool operator()(MathVector< 1 > &val, const MathVector< dim > x, number time, int si) const
Definition: obstacle_constraint_interface.h:289
SubsetGroup ssGrp
Definition: obstacle_constraint_interface.h:299
bool bWholeDomain
Definition: obstacle_constraint_interface.h:300
NumberData(SmartPtr< UserData< number, dim > > functor_, std::string fctName_)
Definition: obstacle_constraint_interface.h:280
NumberData(SmartPtr< UserData< number, dim > > functor_, std::string fctName_, std::string ssName_)
Definition: obstacle_constraint_interface.h:284
std::string fctName
Definition: obstacle_constraint_interface.h:296
std::string ssName
Definition: obstacle_constraint_interface.h:297
SmartPtr< UserData< number, dim > > spFunctor
Definition: obstacle_constraint_interface.h:295
grouping for subset and non-conditional data
Definition: obstacle_constraint_interface.h:363
bool operator()(MathVector< dim > &val, const MathVector< dim > x, number time, int si) const
Definition: obstacle_constraint_interface.h:376
VectorData(SmartPtr< UserData< MathVector< dim >, dim > > value_, std::string fctName_, std::string ssName_)
Definition: obstacle_constraint_interface.h:371
std::string fctName
Definition: obstacle_constraint_interface.h:383
MathVector< dim > value_type
Definition: obstacle_constraint_interface.h:366
SmartPtr< UserData< MathVector< dim >, dim > > spFunctor
Definition: obstacle_constraint_interface.h:382
std::string ssName
Definition: obstacle_constraint_interface.h:384
bool bWholeDomain
Definition: obstacle_constraint_interface.h:387
VectorData(SmartPtr< UserData< MathVector< dim >, dim > > value_, std::string fctName_)
Definition: obstacle_constraint_interface.h:367
SubsetGroup ssGrp
Definition: obstacle_constraint_interface.h:386