12template <
class distributed_vector>
40 j.at (
"hx").get_to (q.
hx);
41 j.at (
"hy").get_to (q.
hy);
67 {
return *(this->data); };
71 {
return *(this->data); };
75 {
return this->data; };
79 {
return this->data; };
83 {
return (data == other.
data); }
87 {
return ! ((*this) == other); }
109 {
return face_idx; };
126 static constexpr idx_t nodes_per_cell = 4;
127 static constexpr idx_t edges_per_cell = 4;
128 static constexpr idx_t NOT_ON_BOUNDARY = -1;
149 shp (
double x,
double y,
idx_t inode)
const;
152 shg (
double x,
double y,
idx_t idir,
idx_t inode)
const;
171 {
return local_cell_idx; };
175 {
return global_cell_idx; };
228 global_cell_idx = sub2gind (rowidx, colidx);
229 local_cell_idx = global_cell_idx -
248 comm (_comm), rank (0), size (1),
253 MPI_Initialized (&flag);
255 MPI_Comm_rank (comm, &rank);
256 MPI_Comm_size (comm, &size);
274 quadgrid_t (
const nlohmann::json &j, MPI_Comm _comm = MPI_COMM_WORLD) :
289 double hx,
double hy);
292 vtk_export (
const char *filename,
293 const std::map<std::string,
294 distributed_vector> & f)
const;
297 octave_ascii_export (
const char *filename,
298 const std::map<std::string,
299 distributed_vector> & f)
const;
305 begin_cell_sweep ()
const;
320 num_local_nodes ()
const;
326 num_local_cells ()
const;
329 num_global_cells ()
const;
quadgrid_t< std::vector< double > >::idx_t idx_t
Definition: check_shg.cpp:7
Definition: quadgrid_cpp.h:55
cell_t * data
Definition: quadgrid_cpp.h:91
cell_iterator(cell_t *_data=nullptr)
Definition: quadgrid_cpp.h:59
Definition: quadgrid_cpp.h:120
idx_t start_cell_row() const
Definition: quadgrid_cpp.h:190
idx_t end_cell_col() const
Definition: quadgrid_cpp.h:178
idx_t sub2gind(idx_t r, idx_t c) const
Definition: quadgrid_cpp.h:210
idx_t global_cell_idx
Definition: quadgrid_cpp.h:240
idx_t row_idx() const
Definition: quadgrid_cpp.h:202
idx_t num_rows() const
Definition: quadgrid_cpp.h:194
idx_t rowidx
Definition: quadgrid_cpp.h:237
idx_t colidx
Definition: quadgrid_cpp.h:238
const neighbor_iterator begin_neighbor_sweep() const
const neighbor_iterator end_neighbor_sweep() const
Definition: quadgrid_cpp.h:165
cell_t(const grid_properties_t &_gp)
Definition: quadgrid_cpp.h:130
idx_t local_cell_idx
Definition: quadgrid_cpp.h:239
idx_t end_cell_row() const
Definition: quadgrid_cpp.h:182
void reset()
Definition: quadgrid_cpp.h:225
idx_t get_global_cell_idx() const
Definition: quadgrid_cpp.h:174
bool is_ghost
Definition: quadgrid_cpp.h:232
const grid_properties_t & grid_properties
Definition: quadgrid_cpp.h:241
idx_t col_idx() const
Definition: quadgrid_cpp.h:206
neighbor_iterator end_neighbor_sweep()
Definition: quadgrid_cpp.h:161
idx_t gind2col(idx_t idx) const
Definition: quadgrid_cpp.h:220
idx_t get_local_cell_idx() const
Definition: quadgrid_cpp.h:170
idx_t gind2row(idx_t idx) const
Definition: quadgrid_cpp.h:215
neighbor_iterator begin_neighbor_sweep()
idx_t num_cols() const
Definition: quadgrid_cpp.h:198
idx_t start_cell_col() const
Definition: quadgrid_cpp.h:186
Definition: quadgrid_cpp.h:96
neighbor_iterator(cell_t *_data=nullptr, int _face_idx=-1)
Definition: quadgrid_cpp.h:103
cell_t * data
Face index in 0...3 (-1 if not defined).
Definition: quadgrid_cpp.h:115
idx_t face_idx
Definition: quadgrid_cpp.h:109
int get_face_idx()
Definition: quadgrid_cpp.h:108
Definition: quadgrid_cpp.h:15
idx_t sub2gind(idx_t r, idx_t c) const
Definition: quadgrid_cpp.h:348
idx_t gind2row(idx_t idx) const
Definition: quadgrid_cpp.h:353
cell_t current_cell
Definition: quadgrid_cpp.h:368
idx_t num_owned_nodes()
Definition: quadgrid_cpp.h:316
idx_t num_cols() const
Definition: quadgrid_cpp.h:336
double hy() const
Definition: quadgrid_cpp.h:344
double hx() const
Definition: quadgrid_cpp.h:340
quadgrid_t(const quadgrid_t &)=delete
Delete copy constructor.
MPI_Comm comm
Definition: quadgrid_cpp.h:362
idx_t num_rows() const
Definition: quadgrid_cpp.h:332
int idx_t
Definition: quadgrid_cpp.h:19
int size
Definition: quadgrid_cpp.h:364
cell_t current_neighbor
Definition: quadgrid_cpp.h:369
void from_json(const nlohmann::json &j, grid_properties_t &q)
Definition: quadgrid_cpp.h:36
quadgrid_t(const nlohmann::json &j, MPI_Comm _comm=MPI_COMM_WORLD)
Ctor that reads grid properties from a json object.
Definition: quadgrid_cpp.h:274
const cell_iterator end_cell_sweep() const
Definition: quadgrid_cpp.h:312
grid_properties_t grid_properties
Definition: quadgrid_cpp.h:371
quadgrid_t(MPI_Comm _comm=MPI_COMM_WORLD)
Default constructor, set all pointers to nullptr.
Definition: quadgrid_cpp.h:247
cell_iterator end_cell_sweep()
Definition: quadgrid_cpp.h:308
int rank
Definition: quadgrid_cpp.h:363
~quadgrid_t()=default
Destructor.
idx_t gind2col(idx_t idx) const
Definition: quadgrid_cpp.h:358
Definition: quadgrid_cpp.h:23
idx_t start_cell_row
Definition: quadgrid_cpp.h:27
double hy
Definition: quadgrid_cpp.h:26
idx_t end_cell_row
Definition: quadgrid_cpp.h:28
idx_t end_cell_col
Definition: quadgrid_cpp.h:30
double hx
Definition: quadgrid_cpp.h:26
idx_t start_cell_col
Definition: quadgrid_cpp.h:29
idx_t numcols
Definition: quadgrid_cpp.h:25
idx_t numrows
Definition: quadgrid_cpp.h:24
idx_t num_owned_nodes
Definition: quadgrid_cpp.h:32
idx_t start_owned_nodes
Definition: quadgrid_cpp.h:31