Beispiel #1
0
/* -------- Heart of the mex file----------- */
void mainloop(double *nodes,
        double *elements,
        double *element_area,
        double *dphir,
        double *dphii,
        double *aphir,
        double *aphii,
        double *Jr,
        double *Ji,
        int nodem,
        int noden,
        int elemm,
        int elemn,
        int isComplex) {
    int ele, i, j, k, index[4];
    double indextmp, val, scale;
    
    if (isComplex > 0) {
        for (ele=0; ele<elemm; ++ele){
            for (i=0; i<elemn; ++i){
                indextmp = *(elements+(ele+(i*elemm)));
                index[i] = indextmp - 1;
            }
            
            for (i=0; i<4; ++i){
                for (j=0; j<4; ++j){
                    for (k=0; k<4; ++k){
                        
                        val = IntFFF(i, j, k)* *(element_area+ele);
                        Jr[index[i]] +=  ((*(dphir+index[k]) * *(aphir+index[j])) - \
                                (*(dphii+index[k]) * *(aphii+index[j])))*val;
                        Ji[index[i]] +=  ((*(dphir+index[k]) * *(aphii+index[j])) + \
                                (*(dphii+index[k]) * *(aphir+index[j])))*val;
                    }
                }
            }
        }
    } else {
        for (ele=0; ele<elemm; ++ele){
            for (i=0; i<elemn; ++i){
                indextmp = *(elements+(ele+(i*elemm)));
                index[i] = indextmp - 1;
            }
            
            for (i=0; i<4; ++i){
                for (j=0; j<4; ++j){
                    for (k=0; k<4; ++k){
                                                
                        val = IntFFF(i, j, k)* *(element_area+ele);
                        Jr[index[i]] +=  ((*(dphir+index[k]) * *(aphir+index[j])))*val;
                    }
                }
            }
        }
    }
    return;
}
Beispiel #2
0
/* -------- Heart of the mex file----------- */
void mainloop(double *nodes,
	      double *elements,
	      double *element_area,
	      double *dphir,
	      double *dphii,
	      double *aphir,
	      double *aphii,
	      double *Jr,
	      double *Ji,
	      int nodem,
	      int noden,
	      int elemm,
	      int elemn)
{
  int ele, i, j, k, indextmp2[3], index[3];
  double indextmp, val;

  for (ele=0; ele<elemm; ++ele){
    for (i=0; i<elemn; ++i){
      indextmp = *(elements+(ele+(i*elemm)));
      index[i] = indextmp;
    }

    for (i=0; i<3; ++i){
      for (j=0; j<3; ++j){
	for (k=0; k<3; ++k){
	  val = IntFFF(i,j,k)* *(element_area+ele);
	  Jr[index[i]-1] +=  ((*(dphir+index[k]-1) * *(aphir+index[j]-1)) - \
			      (*(dphii+index[k]-1) * *(aphii+index[j]-1)))*val;
	  Ji[index[i]-1] +=  ((*(dphir+index[k]-1) * *(aphii+index[j]-1)) + \
			      (*(dphii+index[k]-1) * *(aphir+index[j]-1)))*val;
	}
      }
    }
  }
  return;
}