-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGrid2d.h
More file actions
46 lines (40 loc) · 1.16 KB
/
Grid2d.h
File metadata and controls
46 lines (40 loc) · 1.16 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
//
// Created by Matt Blomquist on 9/6/22.
//
#ifndef LAB01_GRID2D_H
#define LAB01_GRID2D_H
#include <iostream>
#include <fstream>
#include <vector>
class Grid2d {
// Objective: creates a 2D grid
private:
double dx; // spacing in x
double dy; // spacing in y
long N; // number of nodes in x
long M; // number of nodes in y
double xmin;
double xmax;
double ymin;
double ymax;
public:
double get_dx(); // return dx to user
double get_dy(); // return dy to user
// Constructor to create object
Grid2d();
// Constructor to initialize values
Grid2d(long NN, long MM, double xlo, double xhi, double ylo, double yhi);
// Return coord (i,j) from grid index n
long i_from_n(long n);
long j_from_n(long n);
// Return grid index n from coord (i, j)
long n_from_ij(long i, long j);
// Return position of grid index n
double x_from_n(long n);
double y_from_n(long n);
// output file in VTK format
void print_VTK_format(std::string output_file);
void print_VTK_format(std::vector<double> &F, std::string data_name,
std::string file_name);
};
#endif //LAB01_GRID2D_H