48 lines
995 B
Markdown
48 lines
995 B
Markdown
# Parameters - Class for sharing data between classes
|
|
## Using
|
|
* Copy the source files into the corresponding directory in your project
|
|
* Create a pointer and initialize the class. For example:
|
|
|
|
```
|
|
Parameters *parameters = Parameters::GetInstance();
|
|
```
|
|
|
|
It's the only way to initialize it, because the constructor is private.
|
|
|
|
## How it works?
|
|
On the first initialization, it reads the file in the given format:
|
|
|
|
Energy Shape <br />
|
|
Length_X Lenght_Y Length_Z <br />
|
|
Nx Ny Nz <br />
|
|
index material (*Nx*Ny*Nz)
|
|
|
|
|
|
Throws error if the index is incorrect in the file.
|
|
|
|
## Public functions
|
|
|
|
Returns with the material form the list by it's index (returns -1 if the index is out of range):
|
|
|
|
```
|
|
double GetMaterial(int index);
|
|
```
|
|
|
|
Returns with the material from the list by it's coordinates (not implemented yet):
|
|
|
|
```
|
|
double GetMaterial(int x, int y, int z);
|
|
```
|
|
|
|
Returns with the list size:
|
|
|
|
```
|
|
double GetListSize();
|
|
```
|
|
|
|
Returns with the vector:
|
|
|
|
```
|
|
std::vector<double> GetMaterialList();
|
|
```
|