Peano
Loading...
Searching...
No Matches
Face.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5/* Represents a 2D face */
6/* 0 nx */
7/* -------------- */
8/* ny | | ny */
9/* | | */
10/* | | */
11/* | | */
12/* 0 | | 0 */
13/* -------------- */
14/* 0 nx */
15
18
19#include <functional>
20#include <string>
21#include <vector>
22
23namespace toolbox {
24 namespace curvi {
25 class FaceBoundary;
26 } // namespace curvi
27} // namespace toolbox
28
29namespace toolbox {
30 namespace curvi {
31 class Face {
32 public:
35 int a_index_offset[3],
36 FaceBoundary& boundary,
37 std::function<double(double, double)> a_perturbation = [](double y, double x) { return 0.0; },
38 bool keepBoundary = false
39 );
40
42 const Coordinate a_coords[2],
43 const int a_index_offset[3],
44 const int a_index_size[3],
45 const double offset_mu,
46 std::function<double(double, double)> a_perturbation = [](double y, double x) { return 0.0; }
47 );
48
49 Face(const Face& other); /*Copy constructor*/
50 Face& operator=(Face other); /*Copy assignment*/
51
52 Coordinate getCoord(int i) const;
53 void getCoord(Coordinate a_coord[2]) const;
54
55 int getIndexOffset(Coordinate coord) const;
56 void getIndexOffset(int a_indexoffset[3]) const;
57
58 int getIndexSize(Coordinate coord) const;
59 void getIndexSize(int a_size[3]) const;
60
61 void getIndexRange(Coordinate coord, std::vector<int>& range) const;
62
63 std::function<double(double, double)> getPerturbation() const;
64
65 double getPosition() const;
66 Edge split(Face& other, Face& left, Face& right) const;
67
69 double f0,
70 double f1,
71 double t0,
72 double t1,
73 double x0,
74 double x1,
75 double y0,
76 double y1,
77 double& x,
78 double& y
79 ) const;
80
82 void remesh();
83
84 void subface(int subface_index_offset[3], int subface_index_size[3], Face& subface) const;
85
86 const std::vector<double>& getNodes() const;
87 double& operator()(int coord, int j, int i);
88 const double& operator()(int coord, int j, int i) const;
89 const double& operator()(int coord, Coordinate coord_j, int j, Coordinate coord_i, int i) const;
90 double& operator()(int coord, Coordinate coord_j, int j, Coordinate coord_i, int i);
91
92 void toNetCDF(std::string filename) const;
93 std::string printNodes() const;
94 friend std::ostream& operator<<(std::ostream& ss, const Face& f);
95
96 private:
99 int index_size[3];
100 double position;
101 std::function<double(double, double)> perturbation;
102 std::vector<double> nodes;
103 };
104 } // namespace curvi
105} // namespace toolbox
Face(const Face &other)
void getIndexSize(int a_size[3]) const
void getCoord(Coordinate a_coord[2]) const
Edge split(Face &other, Face &left, Face &right) const
std::function< double(double, double)> perturbation
Definition Face.h:101
int index_offset[3]
Definition Face.h:98
std::string printNodes() const
friend std::ostream & operator<<(std::ostream &ss, const Face &f)
void subface(int subface_index_offset[3], int subface_index_size[3], Face &subface) const
const std::vector< double > & getNodes() const
std::vector< double > nodes
Definition Face.h:102
int getIndexSize(Coordinate coord) const
void reverseDimension(Coordinate coord)
const double & operator()(int coord, Coordinate coord_j, int j, Coordinate coord_i, int i) const
double & operator()(int coord, Coordinate coord_j, int j, Coordinate coord_i, int i)
bool intersect(double f0, double f1, double t0, double t1, double x0, double x1, double y0, double y1, double &x, double &y) const
Coordinate getCoord(int i) const
void getIndexOffset(int a_indexoffset[3]) const
Face & operator=(Face other)
void getIndexRange(Coordinate coord, std::vector< int > &range) const
double & operator()(int coord, int j, int i)
std::function< double(double, double)> getPerturbation() const
Face(const Coordinate a_coords[2], const int a_index_offset[3], const int a_index_size[3], const double offset_mu, std::function< double(double, double)> a_perturbation=[](double y, double x) { return 0.0;})
const double & operator()(int coord, int j, int i) const
double getPosition() const
int index_size[3]
Definition Face.h:99
Coordinate coords[2]
Definition Face.h:97
Face(int a_index_offset[3], FaceBoundary &boundary, std::function< double(double, double)> a_perturbation=[](double y, double x) { return 0.0;}, bool keepBoundary=false)
void toNetCDF(std::string filename) const
int getIndexOffset(Coordinate coord) const