forked from pcafrica/electrophysiology_solver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplied_current.cpp
40 lines (34 loc) · 912 Bytes
/
applied_current.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "applied_current.hpp"
AppliedCurrent::AppliedCurrent(const Parameters ¶ms)
: Function<dim>()
, params(params)
, p1(params.p1)
, p2(params.p2)
, p3(params.p3)
{
p.push_back(p1);
p.push_back(p2);
p.push_back(p3);
}
void
AppliedCurrent::value_list(const std::vector<Point<dim>> &points,
std::vector<double> &values,
const unsigned int /*component*/) const
{
for (unsigned int i = 0; i < values.size(); ++i)
values[i] = this->value(points[i]);
}
double
AppliedCurrent::value(const Point<dim> &point,
const unsigned int /*component*/) const
{
const double t = this->get_time();
static constexpr double TOL = 3e-3;
if ((p1.distance(point) < TOL || p2.distance(point) < TOL ||
p3.distance(point) < TOL) &&
(t >= 0 && t <= 3e-3))
{
return 300;
}
return 0;
}