Skip to content
Snippets Groups Projects
Commit 5bfd2c10 authored by Van Dung NGUYEN's avatar Van Dung NGUYEN
Browse files

good location for multiscale mpi meassge

parent 99ca0d51
No related branches found
No related tags found
1 merge request!16Transfer updates into jl_gurson
...@@ -213,6 +213,122 @@ template<class Tbulk,class Tfrac> class IPVariable2Enhanced : public Tbulk{ ...@@ -213,6 +213,122 @@ template<class Tbulk,class Tfrac> class IPVariable2Enhanced : public Tbulk{
return; return;
} }
virtual IPVariable* clone() const =0; virtual IPVariable* clone() const =0;
#if defined(HAVE_MPI)
// using in multiscale analysis with MPI
int getMacroNumberElementDataSendToMicroProblem() const {
if (_ipvbulk == NULL or _ipvfrac == NULL ) Msg::Fatal("IPVariable2Enhanced is not correctly initialized");
int nb = _ipvbulk->getMacroNumberElementDataSendToMicroProblem();
int nf = _ipvfrac->getMacroNumberElementDataSendToMicroProblem();
// send
return nb+nf;
};
int getMicroNumberElementDataSendToMacroProblem() const {
if (_ipvbulk == NULL or _ipvfrac == NULL ) Msg::Fatal("IPVariable2Enhanced is not correctly initialized");
int nb = _ipvbulk->getMicroNumberElementDataSendToMacroProblem();
int nf = _ipvfrac->getMicroNumberElementDataSendToMacroProblem();
return nb+nf;
};
void getMacroDataSendToMicroProblem(double* val) const {
if (_ipvbulk == NULL or _ipvfrac == NULL ) Msg::Fatal("IPVariable2Enhanced is not correctly initialized");
int nb = _ipvbulk->getMacroNumberElementDataSendToMicroProblem();
double* bufferBulk = NULL;
if (nb>0){
bufferBulk = new double[nb];
_ipvbulk->getMacroDataSendToMicroProblem(bufferBulk);
for (int idex=0; idex < nb; idex ++){
val[idex] = bufferBulk[idex];
}
delete[] bufferBulk;
}
int nf = _ipvfrac->getMacroNumberElementDataSendToMicroProblem();
double *bufferInterface = NULL;
if (nf >0){
bufferInterface = new double[nf];
_ipvfrac->getMacroDataSendToMicroProblem(bufferInterface);
for (int idex=nb; idex < nb+nf; idex++){
val[idex] = bufferInterface[idex-nb];
}
delete [] bufferInterface;
}
};
void getMicroDataToMacroProblem(double* val) const {
if (_ipvbulk == NULL or _ipvfrac == NULL ) Msg::Fatal("IPVariable2Enhanced is not correctly initialized");
int nb = _ipvbulk->getMicroNumberElementDataSendToMacroProblem();
if (nb>0){
double* bufferBulk = new double[nb];
_ipvbulk->getMicroDataToMacroProblem(bufferBulk);
for (int idex=0; idex < nb; idex ++){
val[idex] = bufferBulk[idex];
}
delete[] bufferBulk;
}
int nf = _ipvfrac->getMicroNumberElementDataSendToMacroProblem();
if (nf >0){
double* bufferInterface = new double[nf];
_ipvfrac->getMicroDataToMacroProblem(bufferInterface);
for (int idex=nb; idex < nb+nf; idex++){
val[idex] = bufferInterface[idex-nb];
}
delete [] bufferInterface;
}
};
void setReceivedMacroDataToMicroProblem(const double* val){
if (_ipvbulk == NULL or _ipvfrac == NULL ) Msg::Fatal("IPVariable2Enhanced is not correctly initialized");
int nb = _ipvbulk->getMacroNumberElementDataSendToMicroProblem();
if (nb>0){
double* bufferBulk = new double[nb];
for (int i=0; i< nb; i++){
bufferBulk[i] = val[i];
}
_ipvbulk->setReceivedMacroDataToMicroProblem(bufferBulk);
delete[] bufferBulk;
}
int nf = _ipvfrac->getMacroNumberElementDataSendToMicroProblem();
if (nf >0){
double* bufferInterface = new double[nf];
for (int i=nb; i< nb+nf; i++){
bufferInterface[i-nb] = val[i];
}
_ipvfrac->setReceivedMacroDataToMicroProblem(bufferInterface);
delete[] bufferInterface;
}
};
void setReceivedMicroDataToMacroProblem(const double* val){
if (_ipvbulk == NULL or _ipvfrac == NULL ) Msg::Fatal("IPVariable2Enhanced is not correctly initialized");
int nb = _ipvbulk->getMicroNumberElementDataSendToMacroProblem();
if (nb>0){
double* bufferBulk = new double[nb];
for (int i=0; i< nb; i++){
bufferBulk[i] = val[i];
}
_ipvbulk->setReceivedMicroDataToMacroProblem(bufferBulk);
delete[] bufferBulk;
}
int nf = _ipvfrac->getMicroNumberElementDataSendToMacroProblem();
if (nf >0){
double* bufferInterface = new double[nf];
for (int i=nb; i< nb+nf; i++){
bufferInterface[i-nb] = val[i];
}
_ipvfrac->setReceivedMicroDataToMacroProblem(bufferInterface);
delete[] bufferInterface;
}
};
#endif
}; };
class IPVariable2ForFractureBase { class IPVariable2ForFractureBase {
......
...@@ -239,119 +239,6 @@ void MultiscaleFractureCohesive3DIPVariable::nobroken(){ ...@@ -239,119 +239,6 @@ void MultiscaleFractureCohesive3DIPVariable::nobroken(){
}; };
#if defined(HAVE_MPI)
// using in multiscale analysis with MPI
int MultiscaleFractureCohesive3DIPVariable::getMacroNumberElementDataSendToMicroProblem() const {
if (_ipvbulk == NULL or _ipvfrac == NULL ) Msg::Fatal("FractureCohesive3DIPVariable is not correctly initialized");
int nb = _ipvbulk->getMacroNumberElementDataSendToMicroProblem();
int nf = _ipvfrac->getMacroNumberElementDataSendToMicroProblem();
// send
return nb+nf;
};
int MultiscaleFractureCohesive3DIPVariable::getMicroNumberElementDataSendToMacroProblem() const {
if (_ipvbulk == NULL or _ipvfrac == NULL ) Msg::Fatal("FractureCohesive3DIPVariable is not correctly initialized");
int nb = _ipvbulk->getMicroNumberElementDataSendToMacroProblem();
int nf = _ipvfrac->getMicroNumberElementDataSendToMacroProblem();
return nb+nf;
};
void MultiscaleFractureCohesive3DIPVariable::getMacroDataSendToMicroProblem(double* val) const {
if (_ipvbulk == NULL or _ipvfrac == NULL ) Msg::Fatal("FractureCohesive3DIPVariable is not correctly initialized");
int nb = _ipvbulk->getMacroNumberElementDataSendToMicroProblem();
double* bufferBulk = NULL;
if (nb>0){
bufferBulk = new double[nb];
_ipvbulk->getMacroDataSendToMicroProblem(bufferBulk);
for (int idex=0; idex < nb; idex ++){
val[idex] = bufferBulk[idex];
}
delete[] bufferBulk;
}
int nf = _ipvfrac->getMacroNumberElementDataSendToMicroProblem();
double *bufferInterface = NULL;
if (nf >0){
bufferInterface = new double[nf];
_ipvfrac->getMacroDataSendToMicroProblem(bufferInterface);
for (int idex=nb; idex < nb+nf; idex++){
val[idex] = bufferInterface[idex-nb];
}
delete [] bufferInterface;
}
};
void MultiscaleFractureCohesive3DIPVariable::getMicroDataToMacroProblem(double* val) const {
if (_ipvbulk == NULL or _ipvfrac == NULL ) Msg::Fatal("FractureCohesive3DIPVariable is not correctly initialized");
int nb = _ipvbulk->getMicroNumberElementDataSendToMacroProblem();
if (nb>0){
double* bufferBulk = new double[nb];
_ipvbulk->getMicroDataToMacroProblem(bufferBulk);
for (int idex=0; idex < nb; idex ++){
val[idex] = bufferBulk[idex];
}
delete[] bufferBulk;
}
int nf = _ipvfrac->getMicroNumberElementDataSendToMacroProblem();
if (nf >0){
double* bufferInterface = new double[nf];
_ipvfrac->getMicroDataToMacroProblem(bufferInterface);
for (int idex=nb; idex < nb+nf; idex++){
val[idex] = bufferInterface[idex-nb];
}
delete [] bufferInterface;
}
};
void MultiscaleFractureCohesive3DIPVariable::setReceivedMacroDataToMicroProblem(const double* val){
if (_ipvbulk == NULL or _ipvfrac == NULL ) Msg::Fatal("FractureCohesive3DIPVariable is not correctly initialized");
int nb = _ipvbulk->getMacroNumberElementDataSendToMicroProblem();
if (nb>0){
double* bufferBulk = new double[nb];
for (int i=0; i< nb; i++){
bufferBulk[i] = val[i];
}
_ipvbulk->setReceivedMacroDataToMicroProblem(bufferBulk);
delete[] bufferBulk;
}
int nf = _ipvfrac->getMacroNumberElementDataSendToMicroProblem();
if (nf >0){
double* bufferInterface = new double[nf];
for (int i=nb; i< nb+nf; i++){
bufferInterface[i-nb] = val[i];
}
_ipvfrac->setReceivedMacroDataToMicroProblem(bufferInterface);
delete[] bufferInterface;
}
};
void MultiscaleFractureCohesive3DIPVariable::setReceivedMicroDataToMacroProblem(const double* val){
if (_ipvbulk == NULL or _ipvfrac == NULL ) Msg::Fatal("FractureCohesive3DIPVariable is not correctly initialized");
int nb = _ipvbulk->getMicroNumberElementDataSendToMacroProblem();
if (nb>0){
double* bufferBulk = new double[nb];
for (int i=0; i< nb; i++){
bufferBulk[i] = val[i];
}
_ipvbulk->setReceivedMicroDataToMacroProblem(bufferBulk);
delete[] bufferBulk;
}
int nf = _ipvfrac->getMicroNumberElementDataSendToMacroProblem();
if (nf >0){
double* bufferInterface = new double[nf];
for (int i=nb; i< nb+nf; i++){
bufferInterface[i-nb] = val[i];
}
_ipvfrac->setReceivedMicroDataToMacroProblem(bufferInterface);
delete[] bufferInterface;
}
};
#endif
void BulkFollowedCohesive3DIPVariable::restart(){ void BulkFollowedCohesive3DIPVariable::restart(){
Cohesive3DIPVariable::restart(); Cohesive3DIPVariable::restart();
......
...@@ -124,20 +124,6 @@ class MultiscaleFractureCohesive3DIPVariable : public FractureCohesive3DIPVariab ...@@ -124,20 +124,6 @@ class MultiscaleFractureCohesive3DIPVariable : public FractureCohesive3DIPVariab
virtual void restart(){ virtual void restart(){
FractureCohesive3DIPVariable::restart(); FractureCohesive3DIPVariable::restart();
}; };
#if defined(HAVE_MPI)
virtual int getMacroNumberElementDataSendToMicroProblem() const;
// get number of values obtained by microscopic analysis to send to macroscopic analysis
virtual int getMicroNumberElementDataSendToMacroProblem() const;
// get macroscopic kinematic data to send to microscopic problem
virtual void getMacroDataSendToMicroProblem(double* val) const;
// get computed data obtaind by microscopic analysis to send to macroscopic analysis
virtual void getMicroDataToMacroProblem(double* val) const;
// set the received data from microscopic analysis to microscopic analysis
virtual void setReceivedMacroDataToMicroProblem(const double* val);
// set the received data from microscopic analysis to macroscopic analysis
virtual void setReceivedMicroDataToMacroProblem(const double* val);
#endif
}; };
// general cohsive Ipv for cohesive data extrated from a bulk law // general cohsive Ipv for cohesive data extrated from a bulk law
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment