-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsimulation_parameters.h
116 lines (88 loc) · 3.21 KB
/
simulation_parameters.h
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
wgms3d - a full-vectorial finite-difference mode solver.
Copyright (C) 2005-2014 Michael Krause <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** \file
*
* Internal data structure for storing the simulation parameters.
*
*/
#ifndef _WGMS3D_SIMULATION_PARAMETERS_H
#define _WGMS3D_SIMULATION_PARAMETERS_H
#include <vector>
#include <memory>
#include "wgms3d.h"
#include "mgp.h"
#include "pml.h"
namespace wgms3d
{
/// Configuration of the mode solver. Will also be passed to
/// instances of class Mode.
struct SimulationParameters
{
public:
FDMode fd_mode;
bool use_five_point_standard;
double k0; /* free-space wave number */
double c; /* Waveguide curvature c = 1/R */
PML pml[4]; /* pml_north, pml_east, pml_south, pml_west */
/* Order: left, right, top, bottom. 0 = Electric wall, 1 =
Magnetic wall. */
int bconds[4];
/* 0 = grid point lies right on wall (default), 1 = two grid
points lie symmetrically around wall (for pseudo-2D mode,
currently non-functional) */
int bcondsym[4];
/* nir = 'n'umber of 'i'nner 'r'ho-grid points = all points that are
* not ghost points. */
/// TODO get rid of this
int nir, niz;
/* number of values stored for a single field component: (=nir*niz) */
/// TODO get rid of this
int fcsize;
/// Grid including ghost points
/// TODO rename
std::vector< double > _rhos, _zs;
/// Grid (_rhos and _zs) with complex stretching
std::vector< std::complex<double> > stretched_rhos, stretched_zs;
/// Waveguide geometry
std::unique_ptr< MGP > mgp;
SimulationParameters (void) {
fd_mode = FDMode::FullVectorial;
use_five_point_standard = false;
k0 = 2 * M_PI / 1.55e-6;
c = 0;
nir = -1; niz = -1; fcsize = -1;
std::memset(bconds, 0, sizeof(bconds));
std::memset(bcondsym, 0, sizeof(bcondsym));
}
/// Returns an array 'retain_list' of size 2*nir*niz, one
/// entry for each discretization point. If retain_list[i] <
/// 0, then point i is known to be zero in advance (Dirichlet
/// BC, or SV/scalar approximation). Otherwise,
/// retain_list[i] contains a non-negative integer. The
/// non-negative entries of retain_list[] are consecutive
/// integers starting at zero. TODO: required for non-root
/// process?
const std::vector<int> & getRetainList() const;
/// 'number_of_unknowns' is the number of non-negative entries
/// in retain_list.
unsigned getNumUnknowns() const;
private:
mutable std::vector<int> retain_list;
mutable unsigned number_of_unknowns;
mutable std::mutex mutables;
void ensureRetainList () const;
};
} // namespace wgms3d
#endif // _WGMS3D_SIMULATION_PARAMETERS_H