From 18c475b8097f3076c8d68dd84000c6874fbd1fe9 Mon Sep 17 00:00:00 2001
From: Van Dung Nguyen <vdg.nguyen@gmail.com>
Date: Sat, 4 Nov 2017 11:14:35 +0100
Subject: [PATCH] space function missing

---
 NonLinearSolver/nlsolver/nonLinearMechSolver.cpp | 11 +++++++++--
 dG3D/src/dG3DMultiscaleMaterialLaw.cpp           |  3 ++-
 dgshell/src/dgC0ShellFunctionSpace.h             | 16 ++++++++--------
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp b/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp
index ecd3c59c9..19e06024f 100644
--- a/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp
+++ b/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp
@@ -131,7 +131,7 @@
 																																			_damageVolumeCenter(0.,0.,0.),_homogenizedCrackSurface(0.),
 																																			_microBCOld(NULL),_microFailureBC(NULL), _failureBCIsSwitched(false),
                                                                       _pathFollowingSwitchCriterion(0.), _failureBasedOnPreviousState(true),
-                                                                      _currentTime(0.),_timeStep(0.)
+                                                                      _currentTime(0.),_timeStep(1.)
 {
   // check parallelization of dofManager
  #if defined(HAVE_MPI)
@@ -2012,7 +2012,14 @@ void nonLinearMechSolver::setTimeForLaw(const double t,const double dt)
 {
   for(std::map<int,materialLaw*>::iterator it=maplaw.begin(); it!=maplaw.end();++it)
   {
-    it->second->setTime(t,dt);
+    if (_microFlag){
+      double macroTime = _currentTime+ t*_timeStep;
+      double tstep = dt*_timeStep; // because
+      it->second->setTime(macroTime,tstep);
+    }
+    else{
+      it->second->setTime(t,dt);
+    }
   }
 }
 
diff --git a/dG3D/src/dG3DMultiscaleMaterialLaw.cpp b/dG3D/src/dG3DMultiscaleMaterialLaw.cpp
index 084135079..6ca578a91 100644
--- a/dG3D/src/dG3DMultiscaleMaterialLaw.cpp
+++ b/dG3D/src/dG3DMultiscaleMaterialLaw.cpp
@@ -206,6 +206,7 @@ void dG3DMultiscaleMaterialLaw::stress(IPVariable* ipv, const IPVariable* ipvpre
 		}
 	}
 	
+  solver->setTime(_currentTime,_timeStep);
   // set tangent averaging flag
   solver->tangentAveragingFlag(stiff);
   // solve micro problem
@@ -1650,7 +1651,7 @@ void MultiscaleThermoMechanicsDG3DMaterialLaw::stress(IPVariable* ipv, const IPV
   solver->getMicroBC()->setConstitutiveExtraDofDiffusionGradient(0,gradT);
   solver->getMicroBC()->setConstitutiveExtraDofDiffusionValue(0,T);
   solver->tangentAveragingFlag(stiff);
-
+  solver->setTime(_currentTime,_timeStep);
   // solve microscopic problem
   double time =solver->microSolve();
 
diff --git a/dgshell/src/dgC0ShellFunctionSpace.h b/dgshell/src/dgC0ShellFunctionSpace.h
index 4c6a95bae..5221bccc2 100644
--- a/dgshell/src/dgC0ShellFunctionSpace.h
+++ b/dgshell/src/dgC0ShellFunctionSpace.h
@@ -36,7 +36,7 @@ class DgC0CgDgLagrangeFunctionSpace : public IsoparametricLagrangeFunctionSpace{
 	}
 
  protected :
-  virtual void getKeysOnElement(MElement *ele, std::vector<Dof> &keys)
+  virtual void getKeysOnElement(MElement *ele, std::vector<Dof> &keys) const
   {
     int nk=ele->getNumVertices(); // return the number of vertices
     // negative type in mpi if the Dof are not located on this partition
@@ -66,7 +66,7 @@ class DgC0CgDgLagrangeFunctionSpace : public IsoparametricLagrangeFunctionSpace{
 
 class DgC0FullDgLagrangeFunctionSpace : public IsoparametricLagrangeFunctionSpace{
  protected:
-  virtual void getKeysOnElement(MElement *ele, std::vector<Dof> &keys){
+  virtual void getKeysOnElement(MElement *ele, std::vector<Dof> &keys) const{
     int nk=ele->getNumVertices(); // return the number of vertices
     #if defined(HAVE_MPI) // small duplication to avoid multiple if in a loop
     if( (ele->getPartition() != 0)and (ele->getPartition() != Msg::GetCommRank() +1))
@@ -104,7 +104,7 @@ class DgC0CgDgBoundaryConditionLagrangeFunctionSpace : public DgC0CgDgLagrangeFu
   DgC0CgDgBoundaryConditionLagrangeFunctionSpace(int id, int comp1, int comp2) : DgC0CgDgLagrangeFunctionSpace(id,comp1,comp2){}
   virtual ~DgC0CgDgBoundaryConditionLagrangeFunctionSpace(){}
 
-  virtual void getKeys(MElement *ele, std::vector<Dof> &keys){
+  virtual void getKeys(MElement *ele, std::vector<Dof> &keys) const{
     DgC0CgDgLagrangeFunctionSpace::getKeysOnElement(ele,keys);
   }
 	virtual FunctionSpaceBase* clone(const int id) const{
@@ -123,7 +123,7 @@ class DgC0CgDgBoundaryConditionLagrangeFunctionSpaceGhost : public DgC0CgDgBound
   virtual ~DgC0CgDgBoundaryConditionLagrangeFunctionSpaceGhost(){};
 
   // Here we be sure that the dofs have negative type (Ghost)
-  virtual void getKeys(MElement *ele, std::vector<Dof> &keys){
+  virtual void getKeys(MElement *ele, std::vector<Dof> &keys) const{
     int nk = ele->getNumVertices();
     for (int j=0;j<_ncomp;++j)
       for (int i=0;i<nk;++i)
@@ -320,14 +320,14 @@ class DgC0FullDgBoundaryConditionLagrangeFunctionSpace : public DgC0FullDgLagran
 		Msg::Fatal("DgC0FullDgBoundaryConditionLagrangeFunctionSpace::clone is not defined");
 	}
 
-  virtual void getKeys(MInterfaceElement *ielem, std::vector<Dof> &keys){
+  virtual void getKeys(MInterfaceElement *ielem, std::vector<Dof> &keys) const{
     Msg::Error("Impossible to get keys on interface element for a Dirichlet Boundary Conditions");
   }
-  virtual void getKeys(MElement *e, std::vector<Dof> &keys){
-    std::map<MElement*,std::pair<MElement*,MElement*> >::iterator itele=mapInter.find(e);
+  virtual void getKeys(MElement *e, std::vector<Dof> &keys) const{
+    std::map<MElement*,std::pair<MElement*,MElement*> >::const_iterator itele=mapInter.find(e);
     MElement *ele1 = itele->second.first;
     MElement *ele2 = itele->second.second;
-    std::map<MElement*,std::pair<std::vector<int>,std::vector<int> > >::iterator itvec=mapLocalVertex.find(e);
+    std::map<MElement*,std::pair<std::vector<int>,std::vector<int> > >::const_iterator itvec=mapLocalVertex.find(e);
     int nbcomp=comp.size();
     #if defined(HAVE_MPI) // small duplication to avoid multiple if in a loop
     if( (ele1->getPartition() != 0)and (ele1->getPartition() != Msg::GetCommRank() +1))
-- 
GitLab