📄 timeswmat.cpp
字号:
#include <stdlib.h>#include "timeswmat.h"#include "matrix.h"#include "vector.h"#include "global.h"#include "intpoints.h"#include "mechmat.h"/** This constructor inializes attributes to zero values. 21.11.2006, TKo*/timeswmat::timeswmat (void){ ncm = 0; gf = NULL;}/** This destructor is only for the formal purposes. 21.11.2006, TKo*/timeswmat::~timeswmat (void){ delete [] gf;}void timeswmat::read(XFILE* in){ long i; xfscanf(in, "%ld", &ncm); if (ncm < 2) { fprintf(stderr, "\n\nError : insufficient number of materials (%ld < 2) is required in\n", ncm); fprintf(stderr, " function %s\n, (file %s, line %d)", __func__, __FILE__, __LINE__); abort(); } gf = new gfunct[ncm]; for (i=0; i < ncm; i++) { gf[i].read(in); }}/** The function returns actual value of Young modulus @param ipp - integration point number @param im - material index @param ido - index of internal variables for given material in the ipp eqother array 21.11.2006, TKo*/double timeswmat::give_actual_ym(long ipp, long im, long ido){ long i, j = 0; long ncompo = 0; double e; for (i = 0; i < ncm; i++) { if (gf[i].getval(Mp->time)) { e = Mm->give_actual_ym(ipp, im+1+i, ido+ncompo); j++; } ncompo += Mm->givencompeqother(ipp, im+1+i); } if (j > 1) { fprintf(stderr, "\n\nError : number of simulateneously switched on materials is %ld > 1\n", j); fprintf(stderr, " function %s, file %s, line %d\n", __func__, __FILE__, __LINE__); abort(); } if (j < 0) { fprintf(stderr, "\n\nError : No material is switched on\n"); fprintf(stderr, " function %s, file %s, line %d\n", __func__, __FILE__, __LINE__); abort(); } return e;} /** The function returns actual value of tensile strength @param ipp - integration point number @param im - material index @param ido - index of internal variables for given material in the ipp eqother array 21.11.2006, TKo*/double timeswmat::give_actual_ft(long ipp, long im, long ido){ long i, j = 0; long ncompo = 0; double ft; for (i = 0; i < ncm; i++) { if (gf[i].getval(Mp->time)) { ft = Mm->give_actual_ft(ipp, im+1+i, ido+ncompo); j++; } ncompo += Mm->givencompeqother(ipp, im+1+i); } if (j > 1) { fprintf(stderr, "\n\nError : number of simulateneously switched on materials is %ld > 1\n", j); fprintf(stderr, " function %s, file %s, line %d\n", __func__, __FILE__, __LINE__); abort(); } if (j < 0) { fprintf(stderr, "\n\nError : No material is switched on\n"); fprintf(stderr, " function %s, file %s, line %d\n", __func__, __FILE__, __LINE__); abort(); } return ft;}/** The function returns number of components of other array @param ipp - integration point number @param im - material index @param ido - index of internal variables for given material in the ipp eqother array 21.11.2006, TKo*/long timeswmat::givencompother (long ipp, long im){ long i; long ncompo = 0; for (i = 0; i < ncm; i++) ncompo += Mm->givencompeqother(ipp, im+1+i); return ncompo;}/** The function returns number of components of eqother array @param ipp - integration point number @param im - material index @param ido - index of internal variables for given material in the ipp eqother array 21.11.2006, TKo*/long timeswmat::givencompeqother (long ipp, long im){ long i; long ncompo = 0; for (i = 0; i < ncm; i++) ncompo += Mm->givencompeqother(ipp, im+1+i); return ncompo;}/** This function computes material stiffnes %matrix. @param d - allocated matrix structure for material stiffness %matrix @param ipp - integration point number @param im - material index @param ido - index of internal variables for given material in the ipp eqother array 21.11.2006, TKo*/void timeswmat::matstiff (matrix &d,long ipp,long im, long ido){ long i, j = 0; long ncompo = 0; for (i = 0; i < ncm; i++) { if (gf[i].getval(Mp->time)) { Mm->matstiff(d, ipp, im+1+i, ido+ncompo); j++; } ncompo += Mm->givencompeqother(ipp, im+1+i); } if (j > 1) { fprintf(stderr, "\n\nError : number of simulateneously switched on materials is %ld > 1\n", j); fprintf(stderr, " function %s, file %s, line %d\n", __func__, __FILE__, __LINE__); abort(); } if (j < 0) { fprintf(stderr, "\n\nError : No material is switched on\n"); fprintf(stderr, " function %s, file %s, line %d\n", __func__, __FILE__, __LINE__); abort(); }}/** This function computes correct stresses in the integration point and stores them into ip stress array. @param ipp - integration point pointer @param im - index of the material in the ipp tm and idm arrays. The standard value is zero. @param ido - index of internal variables for given material in the ipp eqother array 21.11.2006*/void timeswmat::nlstresses (long ipp, long im, long ido){ long i, j = 0; long ncompo = 0; for (i = 0; i < ncm; i++) { if (gf[i].getval(Mp->time)) { Mm->computenlstresses(ipp, im+1+i, ido+ncompo); j++; } ncompo += Mm->givencompeqother(ipp, im+1+i); } if (j > 1) { fprintf(stderr, "\n\nError : number of simulateneously switched on materials is %ld > 1\n", j); fprintf(stderr, " function %s, file %s, line %d\n", __func__, __FILE__, __LINE__); abort(); } if (j < 0) { fprintf(stderr, "\n\nError : No material is switched on\n"); fprintf(stderr, " function %s, file %s, line %d\n", __func__, __FILE__, __LINE__); abort(); }}/** This function updates values in the other array reached in the previous equlibrium state to values reached in the new actual equilibrium state. @param ipp - integration point number in the mechmat ip array. @param im - material index @param ido - index of internal variables for given material in the ipp other array 21.11.2006, TKo*/void timeswmat::updateval (long ipp, long im, long ido){ long i, j = 0; long ncompo = 0; for (i = 0; i < ncm; i++) { if (gf[i].getval(Mp->time)) { Mm->updateipvalmat(ipp, im+1+i, ido+ncompo); j++; } ncompo += Mm->givencompeqother(ipp, im+1+i); } if (j > 1) { fprintf(stderr, "\n\nError : number of simulateneously switched on materials is %ld > 1\n", j); fprintf(stderr, " function %s, file %s, line %d\n", __func__, __FILE__, __LINE__); abort(); } if (j < 0) { fprintf(stderr, "\n\nError : No material is switched on\n"); fprintf(stderr, " function %s, file %s, line %d\n", __func__, __FILE__, __LINE__); abort(); }}/** Function initializes eqother array with initial initial values. Actual value of array Mm->tempr[ipp] is taken as initial temperature. @param ipp - integration point pointer @param im - material index @param ido - index of internal variables for given material in the ipp other array 21.11.2005, TKo*/void timeswmat::initvalues (long ipp, long im, long ido){ long i, j = 0; long ncompo = 0; for (i = 0; i < ncm; i++) { if (gf[i].getval(Mp->time)) { Mm->initvalues(ipp, im+1+i, ido+ncompo); j++; } ncompo += Mm->givencompeqother(ipp, im+1+i); } if (j > 1) { fprintf(stderr, "\n\nError : number of simulateneously switched on materials is %ld > 1\n", j); fprintf(stderr, " function %s, file %s, line %d\n", __func__, __FILE__, __LINE__); abort(); } if (j < 0) { fprintf(stderr, "\n\nError : No material is switched on\n"); fprintf(stderr, " function %s, file %s, line %d\n", __func__, __FILE__, __LINE__); abort(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -