Esempio n. 1
0
/*!
  @par Revision history:
  - 21.11.2006, c
*/
int32 dw_mass( FMField *out, FMField *coef, FMField *state,
	       FMField *bf, VolumeGeometry *vg,
               int32 isDiff )
{
  int32 ii, dim, nQP, nEP, ret = RET_OK;
  FMField *ftfu = 0, *ftf1 = 0, *ftf = 0;

  nQP = vg->bfGM->nLev;
  nEP = vg->bfGM->nCol;
  dim = vg->bfGM->nRow;

  if (isDiff) {
    fmf_createAlloc( &ftf, 1, nQP, nEP * dim, nEP * dim );
    fmf_createAlloc( &ftf1, 1, nQP, nEP, nEP );

    fmf_mulATB_nn( ftf1, bf, bf );

    for (ii = 0; ii < out->nCell; ii++) {
      FMF_SetCell( out, ii );
      FMF_SetCell( coef, ii );
      FMF_SetCell( vg->det, ii );

      bf_buildFTF( ftf, ftf1 );
      fmf_mul( ftf, coef->val );
      fmf_sumLevelsMulF( out, ftf, vg->det->val );

      ERR_CheckGo( ret );
    }
  } else {
    fmf_createAlloc( &ftfu, 1, nQP, dim * nEP, 1 );

    for (ii = 0; ii < out->nCell; ii++) {
      FMF_SetCell( out, ii );
      FMF_SetCell( state, ii );
      FMF_SetCell( coef, ii );
      FMF_SetCell( vg->det, ii );

      bf_actt( ftfu, bf, state );

      fmf_mul( ftfu, coef->val );
      fmf_sumLevelsMulF( out, ftfu, vg->det->val );

      ERR_CheckGo( ret );
    }
  }


 end_label:
  if (isDiff) {
    fmf_freeDestroy( &ftf1 );
    fmf_freeDestroy( &ftf );
  } else {
    fmf_freeDestroy( &ftfu );
  }

  return( ret );
}
Esempio n. 2
0
int32 dw_surface_dot_vector( FMField *out, FMField *coef, FMField *val_qp,
                             SurfaceGeometry *rsg, SurfaceGeometry *csg,
                             int32 isDiff )
{
  int32 ii, dim, nQP, nEPR, nEPC, ret = RET_OK;
  FMField *ftfu = 0, *ftf1 = 0, *ftf = 0;

  nQP = rsg->normal->nLev;
  dim = rsg->normal->nRow;
  nEPR = rsg->bf->nCol;
  nEPC = csg->bf->nCol;

  if (isDiff) {
    fmf_createAlloc( &ftf, 1, nQP, nEPR * dim, nEPC * dim );
    fmf_createAlloc( &ftf1, 1, nQP, nEPR, nEPC );
  } else {
    fmf_createAlloc( &ftfu, 1, nQP, dim * nEPR, 1 );
  }

  for (ii = 0; ii < out->nCell; ii++) {
    FMF_SetCell( out, ii );
    FMF_SetCellX1( coef, ii );
    FMF_SetCell( rsg->det, ii );
    FMF_SetCellX1( rsg->bf, ii );

    if (isDiff) {
      FMF_SetCellX1( csg->bf, ii );

      fmf_mulATB_nn( ftf1, rsg->bf, csg->bf );
      bf_buildFTF( ftf, ftf1 );
      fmf_mul( ftf, coef->val );
      fmf_sumLevelsMulF( out, ftf, rsg->det->val );
    } else {
      FMF_SetCell( val_qp, ii );

      bf_actt( ftfu, rsg->bf, val_qp );
      fmf_mul( ftfu, coef->val );
      fmf_sumLevelsMulF( out, ftfu, rsg->det->val );
    }
    ERR_CheckGo( ret );
  }

 end_label:
  if (isDiff) {
    fmf_freeDestroy( &ftf1 );
    fmf_freeDestroy( &ftf );
  } else {
    fmf_freeDestroy( &ftfu );
  }

  return( ret );
}
Esempio n. 3
0
/*!
  @par Revision history:
  - 21.11.2006, c
*/
int32 dw_volume_dot_vector( FMField *out, FMField *coef, FMField *val_qp,
                            Mapping *rvg, Mapping *cvg,
                            int32 isDiff )
{
  int32 ii, dim, nc, nQP, nEPR, nEPC, ret = RET_OK;
  FMField *ftfu = 0, *ftf1 = 0, *ftf = 0,*cf = 0, *cfu = 0;

  nQP = rvg->nQP;
  dim = rvg->dim;
  nEPR = rvg->bf->nCol;
  nEPC = cvg->bf->nCol;
  nc = coef->nCol;

  if (isDiff) {
    fmf_createAlloc( &ftf, 1, nQP, nEPR * dim, nEPC * dim );

    if (nc == 1) {
      fmf_createAlloc( &ftf1, 1, nQP, nEPR, nEPC );
    } else {
      fmf_createAlloc( &cf, 1, nQP, dim, dim * nEPC );
    }
  } else {
    fmf_createAlloc( &ftfu, 1, nQP, dim * nEPR, 1 );
    if (nc > 1) {
      fmf_createAlloc( &cfu, 1, nQP, dim, 1 );
    }
  }

  for (ii = 0; ii < out->nCell; ii++) {
    FMF_SetCell( out, ii );
    FMF_SetCellX1( coef, ii );
    FMF_SetCell( rvg->det, ii );
    FMF_SetCellX1( rvg->bf, ii );

    if (isDiff) {
      FMF_SetCellX1( cvg->bf, ii );

      if (nc == 1) {
        fmf_mulATB_nn( ftf1, rvg->bf, cvg->bf );
        bf_buildFTF( ftf, ftf1 );
        fmf_mul( ftf, coef->val );
      } else {
        bf_ract( cf, cvg->bf, coef );
        bf_actt( ftf, rvg->bf, cf );
      }
      fmf_sumLevelsMulF( out, ftf, rvg->det->val );
    } else {
      FMF_SetCell( val_qp, ii );

      if (nc == 1) {
        bf_actt( ftfu, rvg->bf, val_qp );
        fmf_mul( ftfu, coef->val );
      } else {
        fmf_mulAB_nn( cfu, coef, val_qp );
        bf_actt( ftfu, rvg->bf, cfu );
      }
      fmf_sumLevelsMulF( out, ftfu, rvg->det->val );
    }
    ERR_CheckGo( ret );
  }

 end_label:
  if (isDiff) {
    fmf_freeDestroy( &ftf );
    if (nc == 1) {
      fmf_freeDestroy( &ftf1 );
    } else {
      fmf_freeDestroy( &cf );
    }
  } else {
    fmf_freeDestroy( &ftfu );
    if (nc > 1) {
      fmf_freeDestroy( &cfu );
    }
  }

  return( ret );
}
Esempio n. 4
0
/*!
  @par Revision history:
  - 21.11.2006, c
*/
int32 dw_mass( FMField *out, float64 coef, FMField *state, int32 offset,
	       FMField *bf, VolumeGeometry *vg,
	       int32 *conn, int32 nEl, int32 nEP,
	       int32 *elList, int32 elList_nRow,
	       int32 isDiff )
{
  int32 ii, iel, dim, nQP, ret = RET_OK;
  FMField *st = 0, *fu = 0, *ftfu = 0, *ftf1 = 0, *ftf = 0;

  nQP = vg->bfGM->nLev;
  dim = vg->bfGM->nRow;

/*   output( "%d %d %d %d %d %d\n", offset, nEl, nEP, nQP, dim, elList_nRow ); */
  if (isDiff) {
    fmf_createAlloc( &ftf, 1, nQP, nEP * dim, nEP * dim );
    fmf_createAlloc( &ftf1, 1, nQP, nEP, nEP );

    fmf_mulATB_nn( ftf1, bf, bf );
    bf_buildFTF( ftf, ftf1 );

/*     fmf_print( bf, stdout, 0 ); */
/*     fmf_print( ftf1, stdout, 0 ); */
/*     fmf_print( ftf, stdout, 0 ); */
/*     sys_pause(); */

    for (ii = 0; ii < elList_nRow; ii++) {
      iel = elList[ii];

      FMF_SetCell( out, ii );
      FMF_SetCell( vg->det, iel );

      fmf_sumLevelsMulF( out, ftf, vg->det->val );
/*       fmf_print( out, stdout, 0 ); */
/*       sys_pause(); */

      ERR_CheckGo( ret );
    }
  } else {
    state->val = FMF_PtrFirst( state ) + offset;

    fmf_createAlloc( &st, 1, 1, dim, nEP );
    fmf_createAlloc( &fu, 1, nQP, dim, 1 );
    fmf_createAlloc( &ftfu, 1, nQP, dim * nEP, 1 );

    for (ii = 0; ii < elList_nRow; ii++) {
      iel = elList[ii];

      FMF_SetCell( out, ii );
      FMF_SetCell( vg->det, iel );

      ele_extractNodalValuesDBD( st, state, conn + nEP * iel );

      bf_act( fu, bf, st );
      bf_actt( ftfu, bf, fu );
      fmf_sumLevelsMulF( out, ftfu, vg->det->val );

      ERR_CheckGo( ret );
    }
  }

  // E.g. 1/dt.
  fmfc_mulC( out, coef );

 end_label:
  if (isDiff) {
    fmf_freeDestroy( &ftf1 );
    fmf_freeDestroy( &ftf );
  } else {
    fmf_freeDestroy( &st ); 
    fmf_freeDestroy( &fu ); 
    fmf_freeDestroy( &ftfu ); 
  }

  return( ret );
}