Mercurial > fem-fenics-eugenio
annotate src/boundarycondition.h @ 31:74cbe97f55af
New class for treatment of BC
* boundarycondition.h: publicly derives from octave_base_value and the private
member is a vector of pointer to dolfin::DirichletBC
* fem_bc.cc: DLD functions which creates a boundarycondition object taking as
input a functionspace, a function_handler and the label of the
sides where the BC has to be applied
* fem_init_env.cc: load also the boundarycondition type
author | gedeone-octave <marco.vassallo@outlook.com> |
---|---|
date | Mon, 15 Jul 2013 17:07:28 +0200 |
parents | |
children | cedb2b5d6455 |
rev | line source |
---|---|
31
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
1 /* |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
2 Copyright (C) 2013 Marco Vassallo |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
3 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
4 This program is free software; you can redistribute it and/or modify it under |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
5 the terms of the GNU General Public License as published by the Free Software |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
6 Foundation; either version 2 of the License, or (at your option) any later |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
7 version. |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
8 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, but WITHOUT |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
12 details. |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
13 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License along with |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
15 this program; if not, see <http://www.gnu.org/licenses/>. |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
16 */ |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
17 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
18 #ifndef _BOUNDARYCONDITION_OCTAVE_ |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
19 #define _BOUNDARYCONDITION_OCTAVE_ |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
20 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
21 #include <memory> |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
22 #include <vector> |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
23 #include <dolfin.h> |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
24 #include <octave/oct.h> |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
25 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
26 class boundarycondition : public octave_base_value |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
27 { |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
28 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
29 public: |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
30 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
31 boundarycondition () : octave_base_value () {} |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
32 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
33 void print (std::ostream& os, bool pr_as_read_syntax = false) const |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
34 { |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
35 for (int i = 0; i < bcu.size (); ++i) |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
36 os << "Boundary condition : " << bcu[i]->str (true) << std::endl; |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
37 } |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
38 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
39 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
40 ~boundarycondition (void) {} |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
41 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
42 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
43 bool is_defined (void) const { return true; } |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
44 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
45 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
46 const std::vector< boost::shared_ptr <const dolfin::DirichletBC> > & get_bc (void) const |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
47 { return bcu; } |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
48 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
49 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
50 void add_bc (const boost::shared_ptr <const dolfin::FunctionSpace> & V, |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
51 boost::shared_ptr<const dolfin::GenericFunction> f, std::size_t n) |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
52 { |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
53 boost::shared_ptr<const dolfin::DirichletBC> p (new dolfin::DirichletBC (V, f, n)); |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
54 bcu.push_back(p); |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
55 } |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
56 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
57 private: |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
58 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
59 std::vector<boost::shared_ptr <const dolfin::DirichletBC> > bcu; |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
60 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
61 DECLARE_OCTAVE_ALLOCATOR; |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
62 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA; |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
63 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
64 }; |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
65 |
74cbe97f55af
New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff
changeset
|
66 #endif |