DOLFIN
DOLFIN C++ interface
Toggle main menu visibility
Loading...
Searching...
No Matches
dolfin
fem
PointSource.h
1
// Copyright (C) 2011 Anders Logg
2
//
3
// This file is part of DOLFIN.
4
//
5
// DOLFIN is free software: you can redistribute it and/or modify
6
// it under the terms of the GNU Lesser General Public License as published by
7
// the Free Software Foundation, either version 3 of the License, or
8
// (at your option) any later version.
9
//
10
// DOLFIN is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public License
16
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17
18
#ifndef __POINT_SOURCE_H
19
#define __POINT_SOURCE_H
20
21
#include <memory>
22
#include <utility>
23
#include <vector>
24
#include <dolfin/geometry/Point.h>
25
26
namespace
dolfin
27
{
28
29
// Forward declarations
30
class
FunctionSpace
;
31
class
GenericMatrix
;
32
class
GenericVector
;
33
class
Mesh
;
34
43
44
class
PointSource
45
{
46
public
:
47
49
PointSource
(std::shared_ptr<const FunctionSpace> V,
const
Point
& p,
50
double
magnitude=1.0);
51
53
PointSource
(std::shared_ptr<const FunctionSpace> V,
54
const
std::vector<std::pair<const Point*, double>> sources);
55
57
PointSource
(std::shared_ptr<const FunctionSpace> V0,
58
std::shared_ptr<const FunctionSpace> V1,
59
const
Point
& p,
60
double
magnitude=1.0);
61
63
PointSource
(std::shared_ptr<const FunctionSpace> V0,
64
std::shared_ptr<const FunctionSpace> V1,
65
const
std::vector<std::pair<const Point*, double>> sources);
66
68
~PointSource
();
69
71
void
apply
(
GenericVector
& b);
72
74
void
apply
(
GenericMatrix
& A);
75
76
private
:
77
78
// FIXME: This should probably be static
79
// Collective MPI method to distribute sources to correct processes
80
void
distribute_sources(
const
Mesh
& mesh,
81
const
std::vector<std::pair<Point, double>>& sources);
82
83
// Check that function space is scalar
84
static
void
check_space_supported(
const
FunctionSpace
& V);
85
86
// The function spaces
87
std::shared_ptr<const FunctionSpace> _function_space0;
88
std::shared_ptr<const FunctionSpace> _function_space1;
89
90
// Source term - pair of points and magnitude
91
std::vector<std::pair<Point, double>> _sources;
92
93
};
94
95
}
96
97
#endif
dolfin::FunctionSpace
Definition
FunctionSpace.h:54
dolfin::GenericMatrix
This class defines a common interface for matrices.
Definition
GenericMatrix.h:47
dolfin::GenericVector
This class defines a common interface for vectors.
Definition
GenericVector.h:48
dolfin::Mesh
Definition
Mesh.h:83
dolfin::PointSource::PointSource
PointSource(std::shared_ptr< const FunctionSpace > V, const Point &p, double magnitude=1.0)
Create point source at given point of given magnitude.
Definition
PointSource.cpp:37
dolfin::PointSource::~PointSource
~PointSource()
Destructor.
Definition
PointSource.cpp:116
dolfin::PointSource::apply
void apply(GenericVector &b)
Apply (add) point source to right-hand side vector.
Definition
PointSource.cpp:206
dolfin::Point
Definition
Point.h:41
dolfin
Definition
adapt.h:30
Generated by
1.17.0