29 #ifndef MaterialVector_h 30 #define MaterialVector_h 33 #include "xc_utils/src/kernel/CommandEntity.h" 34 #include "material/section/ResponseId.h" 35 #include "utility/actor/actor/MovableID.h" 36 #include "utility/matrix/Vector.h" 49 void clear_materials(
void);
51 void alloc(
const std::vector<MAT *> &mats);
58 typedef typename std::vector<MAT *> mat_vector;
59 typedef typename mat_vector::iterator iterator;
60 typedef typename mat_vector::const_iterator const_iterator;
61 typedef typename mat_vector::reference reference;
62 typedef typename mat_vector::const_reference const_reference;
70 void setMaterial(
const MAT *);
71 void setMaterial(
size_t i,MAT *);
72 void setMaterial(
const MAT *,
const std::string &);
73 bool empty(
void)
const;
95 std::set<std::string>
getNames(
void)
const;
109 for(iterator i= mat_vector::begin();i!=mat_vector::end();i++)
111 (*i)= matModel->getCopy();
113 std::cerr << getClassName() <<
"::" << __FUNCTION__
114 <<
"; failed allocate material model pointer\n";
124 const size_t nMat= mats.size();
126 for(
size_t i= 0;i<nMat;i++)
130 (*this)[i]= mats[i]->getCopy();
132 std::cerr << getClassName() <<
"::" << __FUNCTION__
133 <<
"; failed allocate material model pointer\n";
158 for(iterator i= mat_vector::begin();i!=mat_vector::end();i++)
160 (*i)= new_mat->getCopy();
162 std::cerr << getClassName() <<
"::" << __FUNCTION__
163 <<
"; failed allocate material model pointer\n";
174 for(iterator i= mat_vector::begin();i!=mat_vector::end();i++)
176 (*i)= new_mat->getCopy(type.c_str());
178 std::cerr << getClassName() <<
"::" << __FUNCTION__
179 <<
"; failed allocate material model pointer\n";
195 for(iterator i= mat_vector::begin();i!=mat_vector::end();i++)
206 if(mat_vector::empty())
209 return ((*
this)[0]==
nullptr);
216 std::vector<MAT *>::clear();
226 for(iterator i=mat_vector::begin();i!=mat_vector::end();i++)
237 for(iterator i=mat_vector::begin();i!=mat_vector::end();i++)
249 for(iterator i=mat_vector::begin();i!=mat_vector::end();i++)
268 const size_t ncol= getGeneralizedStressSize();
269 const size_t nMat= this->size();
270 m_double retval(nMat,ncol,0.0);
271 for(
size_t i= 0;i<nMat;i++)
273 const Vector &s= (*this)[i]->getGeneralizedStress();
274 for(
size_t j= 0;j<ncol;j++)
284 const size_t ncol= getGeneralizedStrainSize();
285 const size_t nMat= this->size();
286 m_double retval(nMat,ncol,0.0);
287 for(
size_t i= 0;i<nMat;i++)
289 const Vector &s= (*this)[i]->getGeneralizedStrain();
290 for(
size_t j= 0;j<ncol;j++)
301 retval= (*this)[0]->getGeneralizedStress();
302 const size_t nMat= this->size();
303 for(
size_t i= 1;i<nMat;i++)
304 retval+= (*
this)[i]->getGeneralizedStress();
314 retval= (*this)[0]->getGeneralizedStrain();
315 const size_t nMat= this->size();
316 for(
size_t i= 0;i<nMat;i++)
317 retval+= (*
this)[i]->getGeneralizedStrain();
328 const Vector &e= getMeanGeneralizedStrain();
329 const ResponseId &code= (*this)[0]->getType();
330 const int order= code.
Size();
331 for(
register int i= 0;i<order;i++)
344 retval= this->getMeanGeneralizedStrain(MEMBRANE_RESPONSE_n1);
346 retval= this->getMeanGeneralizedStrain(MEMBRANE_RESPONSE_n2);
348 retval= this->getMeanGeneralizedStrain(PLATE_RESPONSE_m1);
350 retval= this->getMeanGeneralizedStrain(PLATE_RESPONSE_m2);
351 else if(cod ==
"q13")
352 retval= this->getMeanGeneralizedStrain(PLATE_RESPONSE_q13);
353 else if(cod ==
"q23")
354 retval= this->getMeanGeneralizedStrain(PLATE_RESPONSE_q23);
355 else if(cod ==
"m12")
356 retval= this->getMeanGeneralizedStrain(PLATE_RESPONSE_m12);
357 else if(cod ==
"n12")
358 retval= this->getMeanGeneralizedStrain(MEMBRANE_RESPONSE_n12);
360 std::cerr << getClassName() <<
"::" << __FUNCTION__
361 <<
"stress code: '" << cod <<
" unknown." << std::endl;
371 const Vector &f= getMeanGeneralizedStress();
372 const ResponseId &code= (*this)[0]->getType();
373 const int order= code.
Size();
374 for(
register int i= 0;i<order;i++)
387 retval= this->getMeanGeneralizedStress(MEMBRANE_RESPONSE_n1);
389 retval= this->getMeanGeneralizedStress(MEMBRANE_RESPONSE_n2);
390 else if(cod ==
"n12")
391 retval= this->getMeanGeneralizedStress(MEMBRANE_RESPONSE_n12);
393 retval= this->getMeanGeneralizedStress(PLATE_RESPONSE_m1);
395 retval= this->getMeanGeneralizedStress(PLATE_RESPONSE_m2);
396 else if(cod ==
"m12")
397 retval= this->getMeanGeneralizedStress(PLATE_RESPONSE_m12);
398 else if(cod ==
"q13")
399 retval= this->getMeanGeneralizedStress(PLATE_RESPONSE_q13);
400 else if(cod ==
"q23")
401 retval= this->getMeanGeneralizedStress(PLATE_RESPONSE_q23);
403 std::cerr << getClassName() <<
"::" << __FUNCTION__
404 <<
"stress code: '" << cod <<
" unknown." << std::endl;
413 const size_t nMat= this->size();
414 m_double retval(nMat,1,0.0);
415 const ResponseId &code= (*this)[0]->getType();
416 const int order= code.
Size();
417 for(
size_t i= 0;i<nMat;i++)
419 const Vector &s= (*this)[i]->getGeneralizedStress();
420 for(
register int j= 0;j<order;j++)
432 const size_t nMat= this->size();
433 m_double retval(nMat,1,0.0);
434 const ResponseId &code= (*this)[0]->getType();
435 const int order= code.
Size();
436 for(
size_t i= 0;i<nMat;i++)
438 const Vector &s= (*this)[i]->getGeneralizedStrain();
439 for(
register int j= 0;j<order;j++)
450 const size_t nMat= this->size();
451 const size_t sz= std::min(nMat,iS.size());
453 std::cerr << getClassName() <<
"::" << __FUNCTION__
455 << iS.size() <<
" generalized strain vectors, expected: " 457 for(
size_t i= 0;i<sz;i++)
458 (*
this)[i]->setInitialGeneralizedStrain(iS[i]);
465 const size_t nMat= this->size();
466 const size_t sz= std::min(nMat,iS.size());
468 std::cerr << getClassName() <<
"::" << __FUNCTION__
470 << iS.size() <<
" generalized strain vectors, expected: " 472 for(
size_t i= 0;i<sz;i++)
473 (*
this)[i]->addInitialGeneralizedStrain(iS[i]);
480 const size_t nMat= this->size();
481 for(
size_t i= 0;i<nMat;i++)
482 (*
this)[i]->zeroInitialGeneralizedStrain();
500 setDbTagDataPos(0,0);
503 setDbTagDataPos(0,1);
504 const size_t nMat= this->size();
507 for(
size_t i= 0;i<nMat;i++)
518 const int flag = getDbTagDataPos(0);
522 const size_t nMat= this->size();
526 for(
size_t i= 0;i<nMat;i++)
530 (*this)[i]= cp.getBrokedMaterial((*
this)[i],cpMat,meta);
540 std::set<std::string> retval;
541 for(const_iterator i= mat_vector::begin();i!=mat_vector::end();i++)
542 retval.insert((*i)->getName());
550 boost::python::list retval;
551 std::set<std::string> tmp= getNames();
552 for(std::set<std::string>::const_iterator i= tmp.begin();i!=tmp.end();i++)
562 int res= sendData(cp);
563 const int dataTag=getDbTag();
566 std::cerr << getClassName() <<
"::" << __FUNCTION__
567 << dataTag <<
" failed to send ID";
575 const int dataTag= this->getDbTag();
579 std::cerr << getClassName() <<
"::" << __FUNCTION__
580 << dataTag <<
" failed to receive ID\n";
Float vector abstraction.
Definition: Vector.h:93
double getMeanGeneralizedStrainByName(const std::string &) const
Returns the component of the average strain vector which has the code being passed as parameter...
Definition: MaterialVector.h:340
void addInitialGeneralizedStrains(const std::vector< Vector > &)
Adds to the materials initial strains the values being passed as parameters.
Definition: MaterialVector.h:463
int sendIdData(const DbTagData &, const int &)
Sends miembro data through the channel being passed as parameter.
Definition: CommParameters.cc:392
void alloc(const std::vector< MAT *> &mats)
Copy materials from another vector.
Definition: MaterialVector.h:121
int revertToLastCommit(void)
Returns materials to its last commited state.
Definition: MaterialVector.h:233
std::set< std::string > getNames(void) const
Return the names of the materials.
Definition: MaterialVector.h:538
int sendSelf(CommParameters &)
Sends object through the channel being passed as parameter.
Definition: MaterialVector.h:559
void setInitialGeneralizedStrains(const std::vector< Vector > &)
Assigns initial values to materials initial strains.
Definition: MaterialVector.h:448
Object that can move between processes.
Definition: MovableObject.h:99
double getMeanGeneralizedStressByName(const std::string &) const
Returns the component of the average generalized stress vector which corresponds to the code being pa...
Definition: MaterialVector.h:383
const Vector & getMeanGeneralizedStress(void) const
Returns average generalized stress values on element. In a future we can enhance this by providing an...
Definition: MaterialVector.h:298
bool empty(void) const
Returns true ifno se ha asignado material.
Definition: MaterialVector.h:204
int receiveIdData(DbTagData &, const int &) const
Receives el miembro data through the channel being passed as parameter.
Definition: CommParameters.cc:396
Vector that stores the dbTags of the class members.
Definition: DbTagData.h:43
int sendData(CommParameters &)
Send object members through the channel being passed as parameter.
Definition: MaterialVector.h:496
boost::python::list getNamesPy(void) const
Return the names of the materials in a python list.
Definition: MaterialVector.h:548
size_t getGeneralizedStrainSize(void) const
Returns the size of generalized strains vector.
Definition: MaterialVector.h:261
int send(DbTagData &, CommParameters &, const CommMetaData &) const
Sends the object.
Definition: DbTagData.cc:102
int recvData(const CommParameters &)
Receives object through the channel being passed as parameter.
Definition: MaterialVector.h:516
MaterialVector< MAT > & operator=(const MaterialVector< MAT > &)
Assignment operator.
Definition: MaterialVector.h:146
Material pointer container.
Definition: MaterialVector.h:46
int receive(DbTagData &, const CommParameters &, const CommMetaData &)
Receive the object.
Definition: DbTagData.cc:106
size_t getGeneralizedStressSize(void) const
Returns the size of stress vector.
Definition: MaterialVector.h:256
m_double getGeneralizedStrain(const int &defID) const
Returns the defID component of generalized strain vector on each integration point.
Definition: MaterialVector.h:430
m_double getGeneralizedStrains(void) const
Returns generalized strain values on each integration point.
Definition: MaterialVector.h:282
Stiffness material contribution response identifiers.
Definition: ResponseId.h:60
const Vector & getMeanGeneralizedStrain(void) const
Returns average generalized strain values on element.In a future we can enhance this by providing an ...
Definition: MaterialVector.h:311
int commitState(void)
Commits materials state (normally after convergence).
Definition: MaterialVector.h:222
m_double getGeneralizedStresses(void) const
Returns generalized stress values on each integration point.
Definition: MaterialVector.h:266
void zeroInitialGeneralizedStrains(void)
Initialize initial strains.
Definition: MaterialVector.h:478
int recvSelf(const CommParameters &)
Receives object through the channel being passed as parameter.
Definition: MaterialVector.h:573
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
Communication parameters between processes.
Definition: CommParameters.h:65
DbTagData & getDbTagData(void) const
Returns a vector to store the dbTags of the class members.
Definition: MaterialVector.h:488
int revertToStart(void)
Return materials to its initial state.
Definition: MaterialVector.h:245
m_double getGeneralizedStress(const int &defID) const
Returns the defID component of generalized stress vector on each integration point.
Definition: MaterialVector.h:411
MaterialVector(const size_t &nMat, const MAT *matModel=nullptr)
Default constructor.
Definition: MaterialVector.h:104
int sendBrokedPtr(MovableObject *ptr, DbTagData &, const BrokedPtrCommMetaData &)
Sends a pointer to movable object through the channel being passed as parameter.
Definition: CommParameters.cc:1104
int Size(void) const
Returns the vector size.
Definition: ID.h:113