numerics
0.1.0
Loading...
Searching...
No Matches
grid2d.hpp
Go to the documentation of this file.
1
/// @file fields/grid2d.hpp
2
/// @brief 2D uniform interior grid: geometry only, no field data.
3
///
4
/// Grid2D describes the spatial discretization of [0,1]^2 into N x N
5
/// interior nodes with spacing h = 1/(N+1). It carries no field values
6
/// and no boundary conditions -- those belong to the operator and the field.
7
#pragma once
8
9
#include "
core/types.hpp
"
10
11
namespace
num
{
12
13
struct
Grid2D
{
14
int
N
;
///< interior nodes per side
15
double
h
;
///< grid spacing = 1/(N+1)
16
17
double
x
(
int
i)
const
{
return
(i + 1) *
h
; }
18
double
y
(
int
j)
const
{
return
(j + 1) *
h
; }
19
int
flat
(
int
i,
int
j)
const
{
return
(i *
N
) + j; }
20
int
size
()
const
{
return
N
*
N
; }
21
};
22
23
}
// namespace num
types.hpp
Core type definitions.
num
Definition
quadrature.hpp:8
num::Grid2D
Definition
grid2d.hpp:13
num::Grid2D::flat
int flat(int i, int j) const
Definition
grid2d.hpp:19
num::Grid2D::N
int N
interior nodes per side
Definition
grid2d.hpp:14
num::Grid2D::x
double x(int i) const
Definition
grid2d.hpp:17
num::Grid2D::y
double y(int j) const
Definition
grid2d.hpp:18
num::Grid2D::h
double h
grid spacing = 1/(N+1)
Definition
grid2d.hpp:15
num::Grid2D::size
int size() const
Definition
grid2d.hpp:20
include
fields
grid2d.hpp
Generated by
1.9.8