Flow123d
master-e663071
src
la
local_constraint.hh
Go to the documentation of this file.
1
/*!
2
*
3
* Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4
*
5
* This program is free software; you can redistribute it and/or modify it under
6
* the terms of the GNU General Public License version 3 as published by the
7
* Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
*
13
*
14
* @file local_constraint.hh
15
* @brief
16
*/
17
18
19
#ifndef LOCAL_CONSTRAINT_HH_
20
#define LOCAL_CONSTRAINT_HH_
21
22
23
#include "
system/asserts.hh
"
24
class
LocSystem;
25
26
enum class
ConstraintType
{
27
none
=0b00,
28
rows
=0b01,
29
cols
=0b10,
30
both
=0b11
31
};
32
33
34
class
LocalConstraint
35
{
36
public
:
37
/// Default constructor
38
LocalConstraint
() :
type_
(
ConstraintType
::
none
) {}
39
40
/// Constructor. Set all data of local constraint.
41
LocalConstraint
(
uint
i_elm,
uint
loc_dof,
double
solution,
double
diag=0.0)
42
:
type_
(
ConstraintType
::
both
),
i_element_
(i_elm),
loc_dof_
(loc_dof),
solution_
(solution),
diag_
(diag) {}
43
44
/// Set only row data to constraint.
45
void
set_row
(
uint
i_elm,
uint
loc_dof,
double
solution,
double
diag=0.0)
46
{
47
ASSERT
(
type_
==
ConstraintType::none
);
48
type_
=
ConstraintType::rows
;
49
i_element_
= i_elm;
50
loc_dof_
= loc_dof;
51
solution_
= solution;
52
diag_
= diag;
53
}
54
55
/// Set only column data to constraint.
56
void
set_col
(
uint
i_elm,
uint
loc_dof,
double
solution)
57
{
58
ASSERT
(
type_
==
ConstraintType::none
);
59
type_
=
ConstraintType::cols
;
60
i_element_
= i_elm;
61
loc_dof_
= loc_dof;
62
solution_
= solution;
63
diag_
= 0.0;
64
}
65
66
/// Getter to i_element
67
inline
uint
i_element
()
const
68
{
69
return
this->
i_element_
;
70
}
71
72
bool
operator <
(
const
LocalConstraint
&other) {
73
return
(
i_element_
< other.
i_element_
);
74
}
75
76
private
:
77
ConstraintType
type_
;
78
uint
i_element_
;
79
uint
loc_dof_
;
80
double
solution_
;
81
double
diag_
;
82
83
friend
class
LocalSystem
;
84
};
85
86
#endif // LOCAL_CONSTRAINT_HH_
LocalConstraint
Definition:
local_constraint.hh:34
LocalConstraint::LocalConstraint
LocalConstraint()
Default constructor.
Definition:
local_constraint.hh:38
LocalSystem
Definition:
local_system.hh:46
LocalConstraint::i_element_
uint i_element_
Definition:
local_constraint.hh:78
LocalConstraint::set_row
void set_row(uint i_elm, uint loc_dof, double solution, double diag=0.0)
Set only row data to constraint.
Definition:
local_constraint.hh:45
ASSERT
#define ASSERT(expr)
Definition:
asserts.hh:351
asserts.hh
Definitions of ASSERTS.
ConstraintType::cols
@ cols
uint
unsigned int uint
Definition:
mh_dofhandler.hh:101
LocalConstraint::solution_
double solution_
Definition:
local_constraint.hh:80
ConstraintType::rows
@ rows
LocalConstraint::set_col
void set_col(uint i_elm, uint loc_dof, double solution)
Set only column data to constraint.
Definition:
local_constraint.hh:56
LocalConstraint::operator<
bool operator<(const LocalConstraint &other)
Definition:
local_constraint.hh:72
ConstraintType
ConstraintType
Definition:
local_constraint.hh:26
LocalConstraint::i_element
uint i_element() const
Getter to i_element.
Definition:
local_constraint.hh:67
ConstraintType::both
@ both
LocalConstraint::diag_
double diag_
Definition:
local_constraint.hh:81
ConstraintType::none
@ none
LocalConstraint::type_
ConstraintType type_
Definition:
local_constraint.hh:77
LocalConstraint::loc_dof_
uint loc_dof_
Definition:
local_constraint.hh:79
LocalConstraint::LocalConstraint
LocalConstraint(uint i_elm, uint loc_dof, double solution, double diag=0.0)
Constructor. Set all data of local constraint.
Definition:
local_constraint.hh:41
IntersectionResult::none
@ none
Generated by
1.8.17