forked from anandrdbz/Couette_Meshless_Multigrid
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrid.h
More file actions
89 lines (82 loc) · 3.05 KB
/
Copy pathgrid.h
File metadata and controls
89 lines (82 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef GRID_H
#define GRID_H
#include "gridclasses.hpp"
#include <tuple>
#include <string>
#include "fileReadingFunctions.h"
#include "general_computation_functions.h"
#include <stdexcept>
#include "math.h"
#include <iostream>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <time.h>
typedef std::tuple<double, double, double> Point;
using std::vector;
using std::cout;
using std::endl;
class Grid {
public:
//Instance Variables
Eigen::VectorXd* values_;
Eigen::VectorXd* sol_;
Eigen::VectorXd* residuals_;
Eigen::VectorXd source_;
Eigen::VectorXd rhs_;
vector<Point> points_;
vector<Boundary> boundaries_;
std::vector<Point> normalVecs_;
vector<deriv_normal_bc> deriv_normal_coeffs_;
GridProperties properties_;
vector<std::pair<int, int>> ptsConn_;
int laplaceMatSize_;
int bcount_;
Eigen::SparseMatrix<double, Eigen::RowMajor>* laplaceMat_;
Eigen::SparseMatrix<double, Eigen::RowMajor>* restrict_mat;
Eigen::SparseMatrix<double, Eigen::RowMajor>* prolong_mat;
Eigen::SparseMatrix<double, Eigen::RowMajor>* interior_mat;
Eigen::SparseMatrix<double, Eigen::RowMajor>* neumann_boundary_coeffs_;
Eigen::IncompleteLUT<double,int> solver;
Eigen::VectorXd diags;
vector<int> bcFlags_;
bool neumannFlag_;
bool implicitFlag_;
Grid(vector<std::tuple<double, double, double>> points, vector<Boundary> boundaries,
GridProperties properties, Eigen::VectorXd source);
~Grid();
void boundaryOp(std::string coarse);
void setBCFlag(int boundary, std::string type, vector<double> boundValue);
void build_laplacian();
void push_inhomog_to_rhs();
void build_normal_vecs(const char* filename, std::string geomtype);
void fix_bounds_conn(std::vector<std::pair<int, int>>& ptsConn);
void build_deriv_normal_bound();
void sor(Eigen::SparseMatrix<double, 1>* matrix, Eigen::VectorXd* values, Eigen::VectorXd rhs);
void setNeumannFlag();
void modify_coeff_neumann(std::string coarse);
void bound_eval_neumann();
void fix_vector_bound_coarse (Eigen::VectorXd* vec);
void print_bc_values();
void print_bc_values(Eigen::VectorXd vec);
void print_check_bc_normal_derivs();
void build_interior_mat();
double cond_L();
Eigen::VectorXd residual();
Eigen::VectorXd true_residual();
void rcm_order_points();
vector<Point> pointIDs_to_vector(const vector<int> &pointIDs);
vector<int> kNearestNeighbors(Point point, bool neumannFlag, bool pointBCFlag, int k);
vector <int> kNearestNeighbors(int pointNumber, bool neumannFlag, int k);
std::tuple<Eigen::MatrixXd, vector<int>, vector<Point>> buildCoeffMatrix(Point point, bool neumann, bool pointBCFlag, int polyDeg);
std::tuple<Eigen::MatrixXd, vector<int>, vector<Point>> buildCoeffMatrix(int pointNum, bool neumann, int polyDeg);
std::pair<Eigen::VectorXd, vector<int>> laplaceWeights(int pointID);
std::pair<Eigen::VectorXd, vector<int>> derivx_weights(int pointID);
std::pair<Eigen::VectorXd, vector<int>> derivy_weights(int pointID);
std::pair<Eigen::VectorXd, vector<int>> pointInterpWeights(Point point, int polyDeg);
int getSize();
int getStencilSize();
int getPolyDeg();
vector<double> cond_rbf;
};
#endif