TDMS
Time Domain Maxwell Solver
Toggle main menu visibility
Loading...
Searching...
No Matches
cell_coordinate.h
Go to the documentation of this file.
1
/**
2
* @file cell_coordinate.h
3
* @author William Graham (ccaegra@ucl.ac.uk)
4
* @brief Container for {ijk} or {IJK} grouped variables
5
*/
6
#pragma once
7
8
#include <spdlog/spdlog.h>
9
10
#include <algorithm>
11
12
13
/**
14
* @brief A structure for holding three values, which typically pertain to the
15
* same quantity but for each of the axial directions.
16
*
17
* Effectively stores the 3-vector (i,j,k). This is typically used to represent
18
* Yee cell indices, or 3D-array dimensions, or the maximum number of Yee cells
19
* in each coordinate direction, for example.
20
*/
21
struct
ijk
{
22
int
i
= 0,
//!< Value in the i/x direction
23
j
= 0,
//!< Value in the j/y direction
24
k
= 0;
//!< Value in the k/z direction
25
26
/** @brief Return the maximum of i,j,k */
27
int
max
()
const
{
return
std::max(std::max(
i
,
j
),
k
); }
28
29
/** @brief Print the (i,j,k) values */
30
void
print
()
const
{ spdlog::info(
"ijk: ({},{},{})"
,
i
,
j
,
k
); }
31
32
ijk
&operator+=(
int
n) {
33
this->i += n;
34
this->
j
+= n;
35
this->
k
+= n;
36
return
*
this
;
37
}
38
};
39
40
/* Synonyms for code readability */
41
42
typedef
ijk
CellCoordinate
;
//!< Index-coordinates (i,j,k) of a Yee cell
43
typedef
ijk
IJKDimensions
;
//!< Holds array dimensions (I_tot, J_tot, K_tot)
CellCoordinate
ijk CellCoordinate
Index-coordinates (i,j,k) of a Yee cell.
Definition
cell_coordinate.h:42
IJKDimensions
ijk IJKDimensions
Holds array dimensions (I_tot, J_tot, K_tot).
Definition
cell_coordinate.h:43
ijk
A structure for holding three values, which typically pertain to the same quantity but for each of th...
Definition
cell_coordinate.h:21
ijk::print
void print() const
Print the (i,j,k) values.
Definition
cell_coordinate.h:30
ijk::i
int i
Value in the i/x direction.
Definition
cell_coordinate.h:22
ijk::j
int j
Value in the j/y direction.
Definition
cell_coordinate.h:23
ijk::max
int max() const
Return the maximum of i,j,k.
Definition
cell_coordinate.h:27
ijk::k
int k
Value in the k/z direction.
Definition
cell_coordinate.h:24
tdms
include
cell_coordinate.h
Generated by
1.17.0