changed some functions to const
This commit is contained in:
parent
09bbf49b1a
commit
70874e56ab
@ -20,14 +20,14 @@
|
||||
|
||||
//! \brief construct an Engine instance
|
||||
//! it's the responsibility of the caller to free the returned pointer
|
||||
Engine* Engine::createEngine(Operator* op)
|
||||
Engine* Engine::createEngine(const Operator* op)
|
||||
{
|
||||
Engine* e = new Engine(op);
|
||||
e->Init();
|
||||
return e;
|
||||
}
|
||||
|
||||
Engine::Engine(Operator* op)
|
||||
Engine::Engine(const Operator* op)
|
||||
{
|
||||
Op = op;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
class Engine
|
||||
{
|
||||
public:
|
||||
static Engine* createEngine(Operator* op);
|
||||
static Engine* createEngine(const Operator* op);
|
||||
virtual ~Engine();
|
||||
|
||||
virtual void Init();
|
||||
@ -38,8 +38,8 @@ public:
|
||||
virtual FDTD_FLOAT**** GetCurrents() {return curr;};
|
||||
|
||||
protected:
|
||||
Engine(Operator* op);
|
||||
Operator* Op;
|
||||
Engine(const Operator* op);
|
||||
const Operator* Op;
|
||||
|
||||
FDTD_FLOAT**** volt;
|
||||
FDTD_FLOAT**** curr;
|
||||
|
@ -205,14 +205,14 @@ struct Operator::Grid_Path Operator::FindPath(double start[], double stop[])
|
||||
return path;
|
||||
}
|
||||
|
||||
double Operator::GetNumberCells()
|
||||
double Operator::GetNumberCells() const
|
||||
{
|
||||
if (numLines)
|
||||
return (numLines[0])*(numLines[1])*(numLines[2]); //it's more like number of nodes???
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Operator::ShowStat()
|
||||
void Operator::ShowStat() const
|
||||
{
|
||||
unsigned int OpSize = 12*numLines[0]*numLines[1]*numLines[2]*sizeof(FDTD_FLOAT);
|
||||
unsigned int FieldSize = 6*numLines[0]*numLines[1]*numLines[2]*sizeof(FDTD_FLOAT);
|
||||
|
@ -46,11 +46,11 @@ public:
|
||||
virtual void ApplyElectricBC(bool* dirs); //applied by default to all boundaries
|
||||
virtual void ApplyMagneticBC(bool* dirs);
|
||||
|
||||
double GetTimestep() {return dT;};
|
||||
double GetTimestep() const {return dT;};
|
||||
unsigned int GetNyquistNum(double fmax);
|
||||
double GetNumberCells();
|
||||
double GetNumberCells() const;
|
||||
|
||||
void ShowStat();
|
||||
void ShowStat() const;
|
||||
|
||||
void DumpOperator2File(string filename);
|
||||
void DumpMaterial2File(string filename);
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "array_ops.h"
|
||||
#include <ostream>
|
||||
|
||||
FDTD_FLOAT*** Create3DArray(unsigned int* numLines)
|
||||
FDTD_FLOAT*** Create3DArray(const unsigned int* numLines)
|
||||
{
|
||||
FDTD_FLOAT*** array=NULL;
|
||||
unsigned int pos[3];
|
||||
@ -38,7 +38,7 @@ FDTD_FLOAT*** Create3DArray(unsigned int* numLines)
|
||||
return array;
|
||||
}
|
||||
|
||||
void Delete3DArray(FDTD_FLOAT*** array, unsigned int* numLines)
|
||||
void Delete3DArray(FDTD_FLOAT*** array, const unsigned int* numLines)
|
||||
{
|
||||
if (array==NULL) return;
|
||||
unsigned int pos[3];
|
||||
@ -53,7 +53,7 @@ void Delete3DArray(FDTD_FLOAT*** array, unsigned int* numLines)
|
||||
delete[] array;
|
||||
}
|
||||
|
||||
FDTD_FLOAT**** Create_N_3DArray(unsigned int* numLines)
|
||||
FDTD_FLOAT**** Create_N_3DArray(const unsigned int* numLines)
|
||||
{
|
||||
FDTD_FLOAT**** array=NULL;
|
||||
array = new FDTD_FLOAT***[3];
|
||||
@ -64,7 +64,7 @@ FDTD_FLOAT**** Create_N_3DArray(unsigned int* numLines)
|
||||
return array;
|
||||
}
|
||||
|
||||
void Delete_N_3DArray(FDTD_FLOAT**** array, unsigned int* numLines)
|
||||
void Delete_N_3DArray(FDTD_FLOAT**** array, const unsigned int* numLines)
|
||||
{
|
||||
if (array==NULL) return;
|
||||
unsigned int pos[3];
|
||||
|
@ -20,12 +20,12 @@
|
||||
|
||||
#include "../FDTD/operator.h"
|
||||
|
||||
FDTD_FLOAT*** Create3DArray(unsigned int* numLines);
|
||||
void Delete3DArray(FDTD_FLOAT*** array, unsigned int* numLines);
|
||||
FDTD_FLOAT*** Create3DArray(const unsigned int* numLines);
|
||||
void Delete3DArray(FDTD_FLOAT*** array, const unsigned int* numLines);
|
||||
|
||||
FDTD_FLOAT**** Create_N_3DArray(unsigned int* numLines);
|
||||
void Delete_N_3DArray(FDTD_FLOAT**** array, unsigned int* numLines);
|
||||
FDTD_FLOAT**** Create_N_3DArray(const unsigned int* numLines);
|
||||
void Delete_N_3DArray(FDTD_FLOAT**** array, const unsigned int* numLines);
|
||||
|
||||
void Dump_N_3DArray2File(ostream &file, FDTD_FLOAT**** array, unsigned int* numLines);
|
||||
void Dump_N_3DArray2File(ostream &file, FDTD_FLOAT**** array, const unsigned int* numLines);
|
||||
|
||||
#endif // ARRAY_OPS_H
|
||||
|
Loading…
Reference in New Issue
Block a user