-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathCubeHeatSource.cc
More file actions
68 lines (59 loc) · 1.67 KB
/
Copy pathCubeHeatSource.cc
File metadata and controls
68 lines (59 loc) · 1.67 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* Copyright (c) 2020 - 2022, the adamantine authors.
*
* This file is subject to the Modified BSD License and may not be distributed
* without copyright and license information. Please refer to the file LICENSE
* for the text and further information on this license.
*/
#include <CubeHeatSource.hh>
#include <instantiation.hh>
#include <types.hh>
namespace adamantine
{
template <int dim>
CubeHeatSource<dim>::CubeHeatSource(boost::property_tree::ptree const &database)
{
_start_time = database.get<double>("start_time");
_end_time = database.get<double>("end_time");
_value = database.get<double>("value");
_min_point[0] = database.get<double>("min_x");
_max_point[0] = database.get<double>("max_x");
_min_point[1] = database.get<double>("min_y");
_max_point[1] = database.get<double>("max_y");
if (dim == 3)
{
_min_point[2] = database.get<double>("min_z");
_max_point[2] = database.get<double>("max_z");
}
}
template <int dim>
void CubeHeatSource<dim>::update_time(double time)
{
_source_on = ((time > _start_time) && (time < _end_time));
}
template <int dim>
double CubeHeatSource<dim>::value(dealii::Point<dim> const &point,
double const /*height*/) const
{
if (_source_on)
{
bool in_source = true;
for (int i = 0; i < dim; ++i)
{
if ((point[i] < _min_point[i]) || (point[i] > _max_point[i]))
{
in_source = false;
break;
}
}
if (in_source)
return _value;
}
return 0.;
}
template <int dim>
double CubeHeatSource<dim>::get_current_height(double const /*time*/) const
{
return _max_point[axis<dim>::z];
}
} // namespace adamantine
INSTANTIATE_DIM(CubeHeatSource)