DP Langevin
Loading...
Searching...
No Matches
langevin_construct_grid1d.cpp
Go to the documentation of this file.
1
5
6#include "langevin_types.hpp"
7#include "langevin_base.hpp"
8
11{
12 const auto n_x = p.n_x;
14
15 // Everywhere except the grid ends
16 for (auto i=1; i<n_x-1; i++)
17 {
18 // Each cell has a L and R neighbor whose indexes are specified here
19 grid_wiring[i][0] = i-1;
20 grid_wiring[i][1] = i+1;
21 }
22
23 // Grid ends
24 switch (p.grid_topologies.at(0))
25 {
26 case GridTopology::PERIODIC:
27 // Each end cell neighbor is the other end cell, so wrap the indexes
28 grid_wiring[0][0] = n_x-1; // left-end left
29 grid_wiring[0][1] = 1; // left-end right
30 grid_wiring[n_x-1][0] = n_x-2; // right-end left VMB: [n_x-1][0] = n_x-2;
31 grid_wiring[n_x-1][1] = 0; // right-end right
32 return true;
33
34 case GridTopology::BOUNDED:
35 // Link each end cell to its adjacent cell only
36 grid_wiring[0] = neighborhood_t(1, 1);
37 grid_wiring[n_x-1] = neighborhood_t(1, n_x-2);
38 return true;
39
40 default:
41 return false;
42 }
43}
grid_wiring_t grid_wiring
Neighorhood topology for all grid cells.
bool construct_1D_grid(const Parameters parameters)
Build 1d Langevin density field grid & topology.
Base class for Langevin equation integrator.
Type definitions for BaseLangevin integrator.
std::vector< int > neighborhood_t
Type for density grid wiring.
std::vector< neighborhood_t > grid_wiring_t
Type for grid-cell neighborhood connections.
Container for BaseLangevin integrator parameters.