KADATH
space_fourD_periodic.cpp
1
/*
2
Copyright 2017 Philippe Grandclement
3
4
This file is part of Kadath.
5
6
Kadath is free software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
Kadath is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with Kadath. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#include "headcpp.hpp"
21
#include "fourD_periodic.hpp"
22
#include "utilities.hpp"
23
#include "point.hpp"
24
#include "scalar.hpp"
25
#include "tensor_impl.hpp"
26
27
namespace
Kadath {
28
Space_fourD_periodic::Space_fourD_periodic
(
int
ttype,
double
omega,
const
Dim_array
& res,
const
Array<double>
& bounds) {
29
30
// Verif :
31
assert (bounds.
get_ndim
()== 1) ;
32
33
ndim
= 4 ;
34
35
nbr_domains
= bounds.
get_size
(0) ;
36
type_base
= ttype ;
37
domains
=
new
Domain
* [
nbr_domains
] ;
38
// Nucleus
39
domains
[0] =
new
Domain_fourD_periodic_nucleus
(0, ttype, bounds(0), omega, res) ;
40
for
(
int
i=1 ; i<
nbr_domains
; i++)
41
domains
[i] =
new
Domain_fourD_periodic_shell
(i, ttype, bounds(i-1), bounds(i), omega, res) ;
42
43
}
44
45
Space_fourD_periodic::Space_fourD_periodic
(FILE* fd) {
46
fread_be (&
nbr_domains
,
sizeof
(
int
), 1, fd) ;
47
fread_be (&
ndim
,
sizeof
(
int
), 1, fd) ;
48
fread_be (&
type_base
,
sizeof
(
int
), 1, fd) ;
49
domains
=
new
Domain
* [
nbr_domains
] ;
50
//nucleus :
51
domains
[0] =
new
Domain_fourD_periodic_nucleus
(0, fd) ;
52
//Shells :
53
for
(
int
i=1 ; i<
nbr_domains
; i++)
54
domains
[i] =
new
Domain_fourD_periodic_shell
(i, fd) ;
55
}
56
57
Space_fourD_periodic::~Space_fourD_periodic() {
58
}
59
60
void
Space_fourD_periodic::save
(FILE* fd)
const
{
61
fwrite_be (&
nbr_domains
,
sizeof
(
int
), 1, fd) ;
62
fwrite_be (&
ndim
,
sizeof
(
int
), 1, fd) ;
63
fwrite_be (&
type_base
,
sizeof
(
int
), 1, fd) ;
64
for
(
int
i=0 ; i<
nbr_domains
; i++)
65
domains
[i]->
save
(fd) ;
66
}
67
68
double
Space_fourD_periodic::get_omega
()
const
{
69
const
Domain_fourD_periodic_nucleus
* periodicnuc =
dynamic_cast<
const
Domain_fourD_periodic_nucleus
*
>
(
domains
[0]) ;
70
return
periodicnuc->
get_ome
() ;
71
72
}
73
}
Kadath::Array< double >
Kadath::Array::get_ndim
int get_ndim() const
Returns the number of dimensions.
Definition:
array.hpp:323
Kadath::Array::get_size
int get_size(int i) const
Returns the size of a given dimension.
Definition:
array.hpp:331
Kadath::Dim_array
Class for storing the dimensions of an array.
Definition:
dim_array.hpp:34
Kadath::Domain_fourD_periodic_nucleus
Class for a spherical nucleus.
Definition:
fourD_periodic.hpp:55
Kadath::Domain_fourD_periodic_nucleus::get_ome
double get_ome() const
Returns omega.
Definition:
fourD_periodic.hpp:103
Kadath::Domain_fourD_periodic_shell
Class for a spherical shell.
Definition:
fourD_periodic.hpp:154
Kadath::Domain
Abstract class that implements the fonctionnalities common to all the type of domains.
Definition:
space.hpp:60
Kadath::Space_fourD_periodic::get_omega
double get_omega() const
Returns omega.
Definition:
space_fourD_periodic.cpp:68
Kadath::Space_fourD_periodic::save
virtual void save(FILE *) const
Saving function.
Definition:
space_fourD_periodic.cpp:60
Kadath::Space_fourD_periodic::Space_fourD_periodic
Space_fourD_periodic(int tt, double omega, const Dim_array &nbr, const Array< double > &bounds)
Standard constructor.
Definition:
space_fourD_periodic.cpp:28
Kadath::Space::type_base
int type_base
Type of basis used (i.e. using either Chebyshev or Legendre polynomials).
Definition:
space.hpp:1367
Kadath::Space::ndim
int ndim
Number of dimensions (should be the same for all the Domains).
Definition:
space.hpp:1366
Kadath::Space::domains
Domain ** domains
Pointers on the various Domains.
Definition:
space.hpp:1368
Kadath::Space::nbr_domains
int nbr_domains
Number od Domains.
Definition:
space.hpp:1365
src
Space
FourD_periodic
space_fourD_periodic.cpp
Generated by
1.9.1