annotate src/boundarycondition.h @ 268:61830a4f9ab9

Improve formatting
author Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
date Thu, 14 Aug 2014 12:26:55 +0200
parents ab35a8b0deef
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
1 /*
151
5fe2a157f4eb Update GPL to v3
gedeone-octave <marcovass89@hotmail.it>
parents: 116
diff changeset
2 Copyright (C) 2013 Marco Vassallo <gedeone-octave@users.sourceforge.net>
31
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
151
5fe2a157f4eb Update GPL to v3
gedeone-octave <marcovass89@hotmail.it>
parents: 116
diff changeset
6 Foundation; either version 3 of the License, or (at your option) any later
31
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>
253
5e9b5bbdc56b Support both DOLFIN 1.3.0 and 1.4.0
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 173
diff changeset
25 #include "dolfin_compat.h"
31
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
26
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
27 class boundarycondition : public octave_base_value
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
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
30 public:
31
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
31
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
32 boundarycondition ()
173
9e944b0d0fc8 Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents: 151
diff changeset
33 : octave_base_value () {}
31
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
34
173
9e944b0d0fc8 Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents: 151
diff changeset
35 void
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
36 print (std::ostream & os, bool pr_as_read_syntax = false) const
31
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
37 {
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
38 for (std::size_t i = 0; i < bcu.size (); ++i)
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
39 { os << "Boundary condition : " << bcu[i]->str (true) << std::endl; }
31
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
40 }
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 ~boundarycondition (void) {}
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
43
173
9e944b0d0fc8 Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents: 151
diff changeset
44 bool
9e944b0d0fc8 Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents: 151
diff changeset
45 is_defined (void) const
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
46 { return true; }
31
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
47
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
48 const std::vector< SHARED_PTR
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
49 <const dolfin::DirichletBC> > &
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
50 get_bc (void) const
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
51 { return bcu; }
31
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
52
173
9e944b0d0fc8 Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents: 151
diff changeset
53 void
253
5e9b5bbdc56b Support both DOLFIN 1.3.0 and 1.4.0
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 173
diff changeset
54 add_bc (const SHARED_PTR <const dolfin::FunctionSpace> & V,
5e9b5bbdc56b Support both DOLFIN 1.3.0 and 1.4.0
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 173
diff changeset
55 SHARED_PTR <const dolfin::GenericFunction> f,
173
9e944b0d0fc8 Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents: 151
diff changeset
56 std::size_t n)
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
57 {
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
58 SHARED_PTR <const dolfin::DirichletBC>
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
59 p (new dolfin::DirichletBC (V, f, n));
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
60 bcu.push_back (p);
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
61 }
31
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
62
258
ab35a8b0deef Support storage of mesh markers via meshfunction
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 253
diff changeset
63 void
ab35a8b0deef Support storage of mesh markers via meshfunction
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 253
diff changeset
64 add_bc (SHARED_PTR <dolfin::FunctionSpace const> const & V,
ab35a8b0deef Support storage of mesh markers via meshfunction
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 253
diff changeset
65 SHARED_PTR <dolfin::GenericFunction const> f,
ab35a8b0deef Support storage of mesh markers via meshfunction
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 253
diff changeset
66 SHARED_PTR <dolfin::MeshFunction <std::size_t> const> const & sd,
ab35a8b0deef Support storage of mesh markers via meshfunction
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 253
diff changeset
67 std::size_t n)
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
68 {
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
69 SHARED_PTR <dolfin::DirichletBC const>
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
70 p (new dolfin::DirichletBC (V, f, sd, n));
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
71 bcu.push_back (p);
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
72 }
258
ab35a8b0deef Support storage of mesh markers via meshfunction
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 253
diff changeset
73
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
74 private:
31
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
75
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
76 std::vector<SHARED_PTR
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
77 <const dolfin::DirichletBC> > bcu;
31
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
78
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
79 DECLARE_OCTAVE_ALLOCATOR;
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
80 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA;
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
81
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
82 };
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
83
81
3b01e1bd7420 Define DEFINE_OCTAVE_ALLOCATOR and DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA
gedeone-octave <marcovass89@hotmail.it>
parents: 44
diff changeset
84 static bool boundarycondition_type_loaded = false;
3b01e1bd7420 Define DEFINE_OCTAVE_ALLOCATOR and DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA
gedeone-octave <marcovass89@hotmail.it>
parents: 44
diff changeset
85
3b01e1bd7420 Define DEFINE_OCTAVE_ALLOCATOR and DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA
gedeone-octave <marcovass89@hotmail.it>
parents: 44
diff changeset
86 DEFINE_OCTAVE_ALLOCATOR (boundarycondition);
173
9e944b0d0fc8 Some Formatting improvements (?)
gedeone-octave <marcovass89@hotmail.it>
parents: 151
diff changeset
87 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (boundarycondition,
268
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
88 "boundarycondition",
61830a4f9ab9 Improve formatting
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents: 258
diff changeset
89 "boundarycondition");
31
74cbe97f55af New class for treatment of BC
gedeone-octave <marco.vassallo@outlook.com>
parents:
diff changeset
90 #endif