Flow123d  DF_patch_fe_data_tables-b678bc1
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 
35 {
36 public:
37  /// Default constructor
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  {
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  {
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:
80  double solution_;
81  double diag_;
82 
83  friend class LocalSystem;
84 };
85 
86 #endif // LOCAL_CONSTRAINT_HH_
Definitions of ASSERTS.
#define ASSERT(expr)
Definition: asserts.hh:351
void set_col(uint i_elm, uint loc_dof, double solution)
Set only column data to constraint.
ConstraintType type_
void set_row(uint i_elm, uint loc_dof, double solution, double diag=0.0)
Set only row data to constraint.
bool operator<(const LocalConstraint &other)
uint i_element() const
Getter to i_element.
LocalConstraint()
Default constructor.
LocalConstraint(uint i_elm, uint loc_dof, double solution, double diag=0.0)
Constructor. Set all data of local constraint.
ConstraintType
unsigned int uint