From f9811fc2b30aca43f5b8214573792525e876f3e1 Mon Sep 17 00:00:00 2001 From: Eric Bechet <eric.bechet@ulg.ac.be> Date: Sat, 12 Dec 2009 10:03:38 +0000 Subject: [PATCH] added an "assemble" algorithm --- Solver/elasticitySolver.cpp | 31 +------------------------------ Solver/terms.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/Solver/elasticitySolver.cpp b/Solver/elasticitySolver.cpp index 21b20c8590..117005fdcf 100644 --- a/Solver/elasticitySolver.cpp +++ b/Solver/elasticitySolver.cpp @@ -513,38 +513,9 @@ void MyelasticitySolver::solve() for (unsigned int i = 0; i < elasticFields.size(); i++) { ElasticTerm<VectorLagrangeFunctionSpace,VectorLagrangeFunctionSpace> Eterm(P123,elasticFields[i]._E,elasticFields[i]._nu); - fullMatrix<double> localMatrix; - std::vector<Dof> R; - for ( groupOfElements::elementContainer::const_iterator it = elasticFields[i].g->begin(); it != elasticFields[i].g->end() ; ++it) - { - MElement *e = *it; - R.clear(); - int integrationOrder = 3 * (e->getPolynomialOrder() - 1) ; - int npts=0; - IntPt *GP; - e->getIntegrationPoints(integrationOrder, &npts, &GP); - Eterm.get(e,npts,GP,localMatrix); - P123.getKeys(e,R); - pAssembler->assemble(R, localMatrix); - } + Assemble(Eterm,P123,elasticFields[i].g->begin(),elasticFields[i].g->end(),*pAssembler); } - -/* - - for (std::map<int, SVector3 >::iterator it = volumeForces.begin();it != volumeForces.end(); ++it) - { - int iVolume = it->first; - SVector3 f = it->second; - printf("-- Force on volume %3d : %8.5f %8.5f %8.5f\n", iVolume, f.x(), f.y(), f.z()); - std::vector<GEntity*> ent = groups[_dim][iVolume]; - for (unsigned int i = 0; i < ent.size(); i++) - { - // to do - // El.addToRightHandSide(*pAssembler, ent[i]); - } - } -*/ /* for (int i=0;i<pAssembler->sizeOfR();i++) { diff --git a/Solver/terms.h b/Solver/terms.h index b229a2f555..62161ba061 100644 --- a/Solver/terms.h +++ b/Solver/terms.h @@ -259,5 +259,22 @@ template<class S1> class LoadTerm : public LinearTerm<S1> }; +template<class T,class S1, class I,class A> void Assemble(T& term,S1& space1,I itbegin,I itend,A& assembler) // symmetric +{ + fullMatrix<double> localMatrix; + std::vector<Dof> R; + for (I it = itbegin;it!=itend; ++it) + { + MElement *e = *it; + R.clear(); + int integrationOrder = 3 * (e->getPolynomialOrder() - 1) ; + int npts=0; + IntPt *GP; + e->getIntegrationPoints(integrationOrder, &npts, &GP); + term.get(e,npts,GP,localMatrix); + space1.getKeys(e,R); + assembler.assemble(R, localMatrix); + } +} #endif// _TERMS_H_ -- GitLab