0

```
//
// DiffusionTerm.h define the equation class to be solved.
//
#ifndef DIFFUSIONTERM_H
#define DIFFUSIONTERM_H
#include<vector>
#include<iostream>
using namespace std;
class Equation;
class DiffusionTerm
{
private:
Equation* pEquation;
public:
DiffusionTerm(Equation* _pEquation ){pEquation=_pEquation; };
~DiffusionTerm(){};
vector<double>Coe;
vector<double>source;
void evaluateCoeAndSource( )
{
vector<double>& ThermalConductivity= pEquation->pMedia->getThermalConductivity() ;
}
};
//
// Equation.h define the equation class to be solved.
//
#ifndef EQUATION_H
#define EQUATION_H
#include "Mesh.h"
#include"Variable.h"
#include"Media.h"
#include"Simulation.h"
#include <string>
#include<vector>
#include <assert.h>
#include <iostream>
#include<map>
using namespace std;
class DiffusionTerm;
class Equation
{
protected:
// the equation name it should be the same with the variaible name
string name;
// the equation residual
double residual;
// a pointer to the Mesh
Mesh* pMesh;
// a pointer to the varible soved in the equation
Variable* pVariable;
// a pointer to the simulation
Simulation* pSimulation;
DiffusionTerm* pDiffusionTerm;
// a pointer to the media
Media* pMedia;
// the matrix A that contain the discretised equation Ax=source
vector<double> csrA;
// the source contain the discretised equation source term
vector<double> source;
map<string,vector<double>> boundaryNameAndVectorMap;
public:
// the default constructor with no parameter
Equation()
{
pVariable=new Variable();
pDiffusionTerm=new DiffusionTerm(this);
int size=pMesh->getNbCells();
pVariable->setSize(size);
source.resize(size);
csrA.resize(pMesh->getNbNoneZero() );
}
// the constructor with one parameter name
Equation(const string& aName) { name=aName; pVariable=new Variable();int size=pMesh->getNbCells(); pVariable->setSize(size);source.resize(size); csrA.resize(pMesh->getNbNoneZero() );}
~Equation(){pVariable->clear();delete pVariable;}
};
#endif
#endif
```

vs2008 gives me the following error:

```
1>------ Build started: Project: FlowingHeat, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>g:\computation\c++cfd\flowingheat\flowingheat\equation.h(56) : error C2514: 'DiffusionTerm' : class has no constructors
1> g:\computation\c++cfd\flowingheat\flowingheat\equation.h(19) : see declaration of 'DiffusionTerm'
```

The problem came from the constructor of Equation. if i delete " pDiffusionTerm=new DiffusionTerm(this);" , it can be compiled sucessfully. Could you please suggest a better way to avoid this circular referencing problem. One way is to declare the class diffusion term in the class equation, but i have many other terms to be defined.

I am confused.

Regards