Beispiel #1
0
/*!
  @par Revision history:
  - 28.11.2005, c
  - 30.05.2007
*/
int32 laplace_act_g_m( FMField *out, FMField *gc, FMField *mtx )
{
  int32 iqp, ic, ik, nEP, nQP, nCol;
  float64 val1, val2, val3;
  float64 *pout, *pmtx, *pg1, *pg2, *pg3;

  nEP = gc->nCol;
  nQP = gc->nLev;
  nCol = mtx->nCol;

/*   output( "%d %d %d %d\n", nEP, nQP, nCol, dim ); */

  switch (gc->nRow) {
  case 3:
    for (iqp = 0; iqp < nQP; iqp++) {
      pg1 = FMF_PtrLevel( gc, iqp );
      pg2 = pg1 + nEP;
      pg3 = pg2 + nEP;
      pout = FMF_PtrLevel( out, iqp );
      
      if (mtx->nLev == nQP) {
	pmtx = FMF_PtrLevel( mtx, iqp );
      } else {
	pmtx = FMF_PtrCurrent( mtx );
      }
      for (ic = 0; ic < nCol; ic++) {
	val1 = val2 = val3 = 0.0;
	for (ik = 0; ik < nEP; ik++) {
/* 	    output( "%d %d %d %d\n", iqp, ic, ik ); */
	  val1 += pg1[ik] * pmtx[ic+nCol*ik];
	  val2 += pg2[ik] * pmtx[ic+nCol*ik];
	  val3 += pg3[ik] * pmtx[ic+nCol*ik];
	}
	pout[ic+0] = val1;
	pout[ic+1] = val2;
	pout[ic+2] = val3;
      }
    }
    break;

  case 2:
    for (iqp = 0; iqp < nQP; iqp++) {
      pg1 = FMF_PtrLevel( gc, iqp );
      pg2 = pg1 + nEP;
      pout = FMF_PtrLevel( out, iqp );
      
      if (mtx->nLev == nQP) {
	pmtx = FMF_PtrLevel( mtx, iqp );
      } else {
	pmtx = FMF_PtrCurrent( mtx );
      }
      for (ic = 0; ic < nCol; ic++) {
	val1 = val2 = 0.0;
	for (ik = 0; ik < nEP; ik++) {
/* 	    output( "%d %d %d %d\n", iqp, ic, ik ); */
	  val1 += pg1[ik] * pmtx[ic+nCol*ik];
	  val2 += pg2[ik] * pmtx[ic+nCol*ik];
	}
	pout[ic+0] = val1;
	pout[ic+1] = val2;
      }
    }
    break;

  default:
    errput( ErrHead "ERR_Switch\n" );
    return( RET_Fail );
  }

  return( RET_OK );
}
Beispiel #2
0
/*!
  @par Revision history:
  - 17.03.2003, c
  - 31.01.2006
  - 06.02.2006
  - 07.03.2006, adopted from mafest1
*/
int32 mat_le_tanModuli11( FMField *mtx, FMField *lam, FMField *mu, int32 mode  )
#define MAT_LE_AuxMacro1_3D \
    do { for (iqp = 0; iqp < nQP; iqp++) { \
      _lam = lam->val[iqp]; \
      _mu = mu->val[iqp]; \
      pd[0] = _lam + 2.0 * _mu; \
      pd[1] = _lam; \
      pd[2] = _lam; \
      pd[6] = _lam; \
      pd[7] = _lam + 2.0 * _mu; \
      pd[8] = _lam; \
      pd[12] = _lam; \
      pd[13] = _lam; \
      pd[14] = _lam + 2.0 * _mu; \
      pd[21] = _mu; \
      pd[28] = _mu; \
      pd[35] = _mu; \
      pd += 36; \
    } } while (0)
#define MAT_LE_AuxMacro2_3D \
    do { for (iqp = 0; iqp < nQP; iqp++) { \
      _lam = lam->val[iqp]; \
      _mu = mu->val[iqp]; \
      mu23 = _mu * (2.0/3.0); \
      mu43 = 2.0 * mu23; \
      pd[0] = mu43; \
      pd[1] = -mu23; \
      pd[2] = -mu23; \
      pd[6] = -mu23; \
      pd[7] = mu43; \
      pd[8] = -mu23; \
      pd[12] = -mu23; \
      pd[13] = -mu23; \
      pd[14] = mu43; \
      pd[21] = _mu; \
      pd[28] = _mu; \
      pd[35] = _mu; \
      pd += 36; \
    } } while (0)
#define MAT_LE_AuxMacro1_2D \
    do { for (iqp = 0; iqp < nQP; iqp++) { \
      _lam = lam->val[iqp]; \
      _mu = mu->val[iqp]; \
      pd[0] = _lam + 2.0 * _mu; \
      pd[1] = _lam; \
      pd[3] = _lam; \
      pd[4] = _lam + 2.0 * _mu; \
      pd[8] = _mu; \
      pd += 9; \
    } } while (0)
#define MAT_LE_AuxMacro2_2D \
    do { for (iqp = 0; iqp < nQP; iqp++) { \
      _lam = lam->val[iqp]; \
      _mu = mu->val[iqp]; \
      mu23 = _mu * (2.0/3.0); \
      mu43 = 2.0 * mu23; \
      pd[0] = mu43; \
      pd[1] = -mu23; \
      pd[3] = -mu23; \
      pd[4] = mu43; \
      pd[8] = _mu; \
      pd += 9; \
    } } while (0)
{
  float64 *pd;
  float64 _lam, _mu;
  int32 nQP, iqp, sym;

  nQP = mtx->nLev;
  sym = mtx->nRow;

  pd = FMF_PtrCurrent( mtx );

  if (sym == 6) {
    if (1) {
      MAT_LE_AuxMacro1_3D;
    } else {
      float64 mu23, mu43;
      MAT_LE_AuxMacro2_3D;
    }
  } else if (sym == 3) {
    if (1) {
      MAT_LE_AuxMacro1_2D;
    } else {
      float64 mu23, mu43;
      MAT_LE_AuxMacro2_2D;
    }
  }

  return( RET_OK );
}