quadgrid 0.1
simple cartesian quad grid with particles for c++/octave
quadgrid.h
Go to the documentation of this file.
1// Copyright (C) 2022 Carlo de Falco
2//
3// This program is free software; you can redistribute it and/or modify it
4// under the terms of the GNU General Public License as published by
5// the Free Software Foundation; either version 3 of the License, or
6// (at your option) any later version.
7//
8// This program is distributed in the hope that it will be useful, but
9// WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program ; see the file COPYING. If not, see
15// <http://www.gnu.org/licenses/>.
16
17#include <octave/oct.h>
18#include <octave/interpreter.h>
19
20#include <quadgrid_cpp.h>
21
22#include <iostream>
23#include <memory>
24
25class
27 : public octave_base_value {
28
29public:
30
31 quadgrid (octave_idx_type nx = 2, double hx = 1.0,
32 octave_idx_type ny = 2, double hy = 1.0)
33 : octave_base_value () {
34 rep = std::make_shared<quadgrid_t<ColumnVector>> ();
35 rep->set_sizes (ny, nx, hx, hy);
36 };
37
38 void
39 print (std::ostream& os, bool pr_as_read_syntax = false) {
40 os << "quadgrid object" << std::endl;
41 os << "nx = " << rep->num_cols () << " ny = " << rep->num_rows () << std::endl;
42 os << "hx = " << rep->hx () << " hy = " << rep->hy () << std::endl;
43 }
44
45 ~quadgrid () = default;
46
47 bool
48 is_defined (void) const
49 { return true; }
50
51 const std::shared_ptr<quadgrid_t<ColumnVector>>
52 quadgrid_value (bool = false) const
53 { return rep; }
54
55 std::shared_ptr<quadgrid_t<ColumnVector>>
56 quadgrid_value (bool = false)
57 { return rep; }
58
59private:
60
61 std::shared_ptr<quadgrid_t<ColumnVector>> rep;
62
64};
65
66const std::shared_ptr<quadgrid_t<ColumnVector>>
67ov_quadgrid (const octave_value &in);
68
69std::shared_ptr<quadgrid_t<ColumnVector>>
70ov_quadgrid (octave_value &in);
71
72bool
73is_quadgrid (const octave_value &in);
Definition: quadgrid.h:27
const std::shared_ptr< quadgrid_t< ColumnVector > > quadgrid_value(bool=false) const
Definition: quadgrid.h:52
std::shared_ptr< quadgrid_t< ColumnVector > > rep
Definition: quadgrid.h:61
~quadgrid()=default
bool is_defined(void) const
Definition: quadgrid.h:48
quadgrid(octave_idx_type nx=2, double hx=1.0, octave_idx_type ny=2, double hy=1.0)
Definition: quadgrid.h:31
std::shared_ptr< quadgrid_t< ColumnVector > > quadgrid_value(bool=false)
Definition: quadgrid.h:56
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: quadgrid.h:63
void print(std::ostream &os, bool pr_as_read_syntax=false)
Definition: quadgrid.h:39
const std::shared_ptr< quadgrid_t< ColumnVector > > ov_quadgrid(const octave_value &in)
Definition: quadgrid.cc:24
bool is_quadgrid(const octave_value &in)
Definition: quadgrid.cc:36