29 #ifndef MaterialVector_h 30 #define MaterialVector_h 33 #include "xc_utils/src/nucleo/EntCmd.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::reference reference;
61 typedef typename mat_vector::const_reference const_reference;
69 void setMaterial(
const MAT *);
70 void setMaterial(
size_t i,MAT *);
71 void setMaterial(
const MAT *,
const std::string &tipo);
72 bool empty(
void)
const;
105 for(iterator i= mat_vector::begin();i!=mat_vector::end();i++)
107 (*i)= matModel->getCopy();
109 std::cerr << nombre_clase() <<
"::" << __FUNCTION__
110 <<
"; failed allocate material model pointer\n";
120 const size_t nMat= mats.size();
122 for(
size_t i= 0;i<nMat;i++)
126 (*this)[i]= mats[i]->getCopy();
128 std::cerr << nombre_clase() <<
"::" << __FUNCTION__
129 <<
"; failed allocate material model pointer\n";
154 for(iterator i= mat_vector::begin();i!=mat_vector::end();i++)
156 (*i)= new_mat->getCopy();
158 std::cerr << nombre_clase() <<
"::" << __FUNCTION__
159 <<
"; failed allocate material model pointer\n";
170 for(iterator i= mat_vector::begin();i!=mat_vector::end();i++)
172 (*i)= new_mat->getCopy(tipo.c_str());
174 std::cerr << nombre_clase() <<
"::" << __FUNCTION__
175 <<
"; failed allocate material model pointer\n";
191 for(iterator i= mat_vector::begin();i!=mat_vector::end();i++)
202 if(mat_vector::empty())
205 return ((*
this)[0]==
nullptr);
212 std::vector<MAT *>::clear();
222 for(iterator i=mat_vector::begin();i!=mat_vector::end();i++)
223 retVal+= (*i)->commitState();
233 for(iterator i=mat_vector::begin();i!=mat_vector::end();i++)
234 retVal+= (*i)->revertToLastCommit() ;
245 for(iterator i=mat_vector::begin();i!=mat_vector::end();i++)
246 retVal+= (*i)->revertToStart() ;
253 {
return (*
this)[0]->getGeneralizedStress().Size(); }
258 {
return (*
this)[0]->getGeneralizedStrain().Size(); }
265 const size_t nMat= this->size();
266 m_double retval(nMat,ncol,0.0);
267 for(
size_t i= 0;i<nMat;i++)
269 const Vector &s= (*this)[i]->getGeneralizedStress();
270 for(
size_t j= 0;j<ncol;j++)
281 const size_t nMat= this->size();
282 m_double retval(nMat,ncol,0.0);
283 for(
size_t i= 0;i<nMat;i++)
285 const Vector &s= (*this)[i]->getGeneralizedStrain();
286 for(
size_t j= 0;j<ncol;j++)
297 retval= (*this)[0]->getGeneralizedStress();
298 const size_t nMat= this->size();
299 for(
size_t i= 1;i<nMat;i++)
300 retval+= (*
this)[i]->getGeneralizedStress();
310 retval= (*this)[0]->getGeneralizedStrain();
311 const size_t nMat= this->size();
312 for(
size_t i= 0;i<nMat;i++)
313 retval+= (*
this)[i]->getGeneralizedStrain();
325 const ResponseId &code= (*this)[0]->getType();
326 const int order= code.Size();
327 for(
register int i= 0;i<order;i++)
347 else if(cod ==
"q13")
349 else if(cod ==
"q23")
351 else if(cod ==
"m12")
353 else if(cod ==
"n12")
356 std::cerr << nombre_clase() <<
"::" << __FUNCTION__
357 <<
"stress code: '" << cod <<
" unknown." << std::endl;
368 const ResponseId &code= (*this)[0]->getType();
369 const int order= code.Size();
370 for(
register int i= 0;i<order;i++)
386 else if(cod ==
"n12")
392 else if(cod ==
"m12")
394 else if(cod ==
"q13")
396 else if(cod ==
"q23")
399 std::cerr << nombre_clase() <<
"::" << __FUNCTION__
400 <<
"stress code: '" << cod <<
" unknown." << std::endl;
409 const size_t nMat= this->size();
410 m_double retval(nMat,1,0.0);
411 const ResponseId &code= (*this)[0]->getType();
412 const int order= code.Size();
413 for(
size_t i= 0;i<nMat;i++)
415 const Vector &s= (*this)[i]->getGeneralizedStress();
416 for(
register int j= 0;j<order;j++)
428 const size_t nMat= this->size();
429 m_double retval(nMat,1,0.0);
430 const ResponseId &code= (*this)[0]->getType();
431 const int order= code.Size();
432 for(
size_t i= 0;i<nMat;i++)
434 const Vector &s= (*this)[i]->getGeneralizedStrain();
435 for(
register int j= 0;j<order;j++)
446 const size_t nMat= this->size();
447 const size_t sz= std::min(nMat,iS.size());
449 std::cerr << nombre_clase() <<
"::" << __FUNCTION__
451 << iS.size() <<
" generalized strain vectors, expected: " 453 for(
size_t i= 0;i<sz;i++)
454 (*
this)[i]->setInitialGeneralizedStrain(iS[i]);
461 const size_t nMat= this->size();
462 const size_t sz= std::min(nMat,iS.size());
464 std::cerr << nombre_clase() <<
"::" << __FUNCTION__
466 << iS.size() <<
" generalized strain vectors, expected: " 468 for(
size_t i= 0;i<sz;i++)
469 (*
this)[i]->addInitialGeneralizedStrain(iS[i]);
476 const size_t nMat= this->size();
477 for(
size_t i= 0;i<nMat;i++)
478 (*
this)[i]->zeroInitialGeneralizedStrain();
500 const size_t nMat= this->size();
503 for(
size_t i= 0;i<nMat;i++)
518 const size_t nMat= this->size();
522 for(
size_t i= 0;i<nMat;i++)
526 (*this)[i]= cp.getBrokedMaterial((*
this)[i],cpMat,meta);
541 std::cerr << nombre_clase() <<
"::" << __FUNCTION__
542 << dataTag <<
" failed to send ID";
550 const int dataTag= this->
getDbTag();
554 std::cerr << nombre_clase() <<
"::" << __FUNCTION__
555 << dataTag <<
" failed to receive ID\n";
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:336
void addInitialGeneralizedStrains(const std::vector< Vector > &)
Adds to the materials initial strains the values being passed as parameters.
Definition: MaterialVector.h:459
int send(DbTagData &, CommParameters &, const CommMetaData &) const
Sends the object.
Definition: DbTagData.cc:102
MaterialVector< MAT > & operator=(const MaterialVector< MAT > &)
Assignment operator.
Definition: MaterialVector.h:142
m_double getGeneralizedStrains(void) const
Returns generalized strain values on each integration point.
Definition: MaterialVector.h:278
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:307
int getDbTag(void) const
Returns the tag para la database.
Definition: MovableObject.cpp:92
Vector que almacena los dbTags de los miembros de la clase.
Definition: DbTagData.h:43
int receiveIdData(DbTagData &, const int &) const
Recibe el miembro data through the channel being passed as parameter.
Definition: CommParameters.cc:396
int sendIdData(const DbTagData &, const int &)
Sends miembro data through the channel being passed as parameter.
Definition: CommParameters.cc:392
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:294
Stiffness material contribution response identifiers.
Definition: ResponseId.h:60
DbTagData & getDbTagData(void) const
Returns a vector para almacenar los dbTags de los miembros de la clase.
Definition: MaterialVector.h:484
Object that can move between processes.
Definition: MovableObject.h:91
bool empty(void) const
Returns true ifno se ha asignado material.
Definition: MaterialVector.h:200
m_double getGeneralizedStresses(void) const
Returns generalized stress values on each integration point.
Definition: MaterialVector.h:262
size_t getGeneralizedStressSize(void) const
Returns the size of stress vector.
Definition: MaterialVector.h:252
int recvData(const CommParameters &)
Receives object through the channel being passed as parameter.
Definition: MaterialVector.h:512
m_double getGeneralizedStrain(const int &defID) const
Returns the defID component of generalized strain vector on each integration point.
Definition: MaterialVector.h:426
int commitState(void)
Commits materials state (normally after convergence).
Definition: MaterialVector.h:218
MaterialVector(const size_t &nMat, const MAT *matModel=nullptr)
Default constructor.
Definition: MaterialVector.h:100
Material pointer container. It's used by elements to store materials for each integration point...
Definition: MaterialVector.h:46
size_t getGeneralizedStrainSize(void) const
Returns the size of generalized strains vector.
Definition: MaterialVector.h:257
void setInitialGeneralizedStrains(const std::vector< Vector > &)
Assigns initial values to materials initial strains.
Definition: MaterialVector.h:444
int receive(DbTagData &, const CommParameters &, const CommMetaData &)
Recibe el objeto.
Definition: DbTagData.cc:106
int recvSelf(const CommParameters &)
Receives object through the channel being passed as parameter.
Definition: MaterialVector.h:548
void inicComm(const int &dataSize) const
Initializes communication.
Definition: DistributedBase.cc:57
int revertToStart(void)
Return materials to its initial state.
Definition: MaterialVector.h:241
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:379
void alloc(const std::vector< MAT * > &mats)
Copy materials from another vector.
Definition: MaterialVector.h:117
Communication parameters between processes.
Definition: CommParameters.h:65
int sendData(CommParameters &)
Send object members through the channel being passed as parameter.
Definition: MaterialVector.h:492
================================================================================
Definition: ContinuaReprComponent.h:34
const int & getDbTagDataPos(const int &i) const
Returns the data at the i-th position.
Definition: DistributedBase.cc:49
int sendBrokedPtr(MovableObject *ptr, DbTagData &, const BrokedPtrCommMetaData &)
Envía a pointer to movable object through the channel being passed as parameter.
Definition: CommParameters.cc:996
void setDbTagDataPos(const int &i, const int &v)
Sets the data at the i-th position.
Definition: DistributedBase.cc:53
m_double getGeneralizedStress(const int &defID) const
Returns the defID component of generalized stress vector on each integration point.
Definition: MaterialVector.h:407
int sendSelf(CommParameters &)
Sends object through the channel being passed as parameter.
Definition: MaterialVector.h:534
int revertToLastCommit(void)
Returns materials to its last commited state.
Definition: MaterialVector.h:229
void zeroInitialGeneralizedStrains(void)
Initialize initial strains.
Definition: MaterialVector.h:474