PPCKO: Principal Predictive Components for Estimating an Autoregressive Operator
 
Loading...
Searching...
No Matches
mesh.hpp
Go to the documentation of this file.
1// Copyright (c) 2024 Andrea Enrico Franzoni (andreaenrico.franzoni@gmail.com)
2//
3// This file is part of PPCKO
4//
5// Permission is hereby granted, free of charge, to any person obtaining a copy
6// of PPCKO and associated documentation files (the PPCKO software), to deal
7// PPCKO without restriction, including without limitation the rights
8// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9// copies of PPCKO, and to permit persons to whom PPCKO is
10// furnished to do so, subject to the following conditions:
11//
12// PPCKO IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17// OUT OF OR IN CONNECTION WITH PPCKO OR THE USE OR OTHER DEALINGS IN
18// PPCKO.
19
20#ifndef _HH_MESH_HH
21#define _HH_MESH_HH
22#include "domain.hpp"
23#include "meshGenerators.hpp"
24#include <functional>
25#include <vector>
26
33
34namespace Geometry
35{
36class Mesh1D
37{
38public:
40 Mesh1D() = default;
42
46 Mesh1D(Domain1D const &d, unsigned int const &n);
48
52 : myDomain{gf.getDomain()}, myNodes{gf()} {};
53
54
57 void reset(OneDMeshGenerator const &mg);
58
60 unsigned int
61 numNodes() const
62 {
63 return myNodes.size();
64 }
65
66 double
67 operator[](int i) const
68 {
69 return myNodes[i];
70 }
71
72 std::vector<double>
73 nodes() const
74 {
75 return myNodes;
76 }
77
78 std::vector<double>::iterator
80 {
81 return myNodes.begin();
82 }
83 std::vector<double>::const_iterator
84 cbegin() const
85 {
86 return myNodes.cbegin();
87 }
89 std::vector<double>::iterator
91 {
92 return myNodes.end();
93 }
94 std::vector<double>::const_iterator
95 cend() const
96 {
97 return myNodes.cend();
98 }
100
103 Domain1D
104 domain() const
105 {
106 return myDomain;
107 }
108
109 double hmin() const;
111 double hmax() const;
112
113private:
114 Domain1D myDomain;
115 std::vector<double> myNodes;
116};
117
118} // namespace Geometry
119#endif
Definition domain.hpp:37
std::vector< double > nodes() const
The nodes.
Definition mesh.hpp:73
std::vector< double >::iterator end()
To use the mesh in range based for loop I need end()
Definition mesh.hpp:90
std::vector< double >::iterator begin()
To use the mesh in range based for loop I need begin()
Definition mesh.hpp:79
double hmin() const
The max mesh size.
Definition mesh.cpp:48
void reset(OneDMeshGenerator const &mg)
Generate mesh (it will destroy old mesh)
Definition mesh.cpp:56
double operator[](int i) const
The i-th node.
Definition mesh.hpp:67
unsigned int numNodes() const
Number of nodes.
Definition mesh.hpp:61
double hmax() const
The max mesh size.
Definition mesh.cpp:40
Mesh1D()=default
Default constructor is defaulted.
Mesh1D(Geometry::OneDMeshGenerator const &gf)
Constructor for an variably spaced mesh.
Definition mesh.hpp:51
Domain1D domain() const
I return a copy of the DOmain1D.
Definition mesh.hpp:104
General interface.
Definition meshGenerators.hpp:40
Contains the class for an unidimensioanl domain.
Contains the class for generating an unidimensional mesh. Little modification: retained only the part...
Definition domain.cpp:32