Commits

Lisandro Dalcin  committed 9bb9f2d

Rename IGAPointGetXXX -> IGAPointFormXXX

  • Participants
  • Parent commits 95c4f98

Comments (0)

Files changed (13)

File demo/CahnHilliard2D.c

   AppCtx *user = (AppCtx *)ctx;
  
   PetscScalar c,c1[3];
-  IGAPointGetValue(p,U,&c); 
-  IGAPointGetGrad(p,U,&c1[0]);
+  IGAPointFormValue(p,U,&c); 
+  IGAPointFormGrad(p,U,&c1[0]);
   PetscScalar diff = c - user->cbar;
 
   S[0] = GinzburgLandauFreeEnergy(c,c1[0],c1[1],user); // Free energy
   IGAPointGetSizes(p,&nen,0,0);
 
   PetscScalar c_t,c;
-  IGAPointGetValue(p,V,&c_t);
-  IGAPointGetValue(p,U,&c);
+  IGAPointFormValue(p,V,&c_t);
+  IGAPointFormValue(p,U,&c);
 
   PetscReal M,dM;
   Mobility(user,c,&M,&dM,NULL);
   ChemicalPotential(user,c,NULL,&dmu,NULL);
 
   PetscScalar c1[2],c2[2][2];
-  IGAPointGetGrad(p,U,&c1[0]);
-  IGAPointGetHess(p,U,&c2[0][0]);
+  IGAPointFormGrad(p,U,&c1[0]);
+  IGAPointFormHess(p,U,&c2[0][0]);
   PetscScalar c_x  = c1[0],    c_y  = c1[1];
   PetscScalar c_xx = c2[0][0], c_yy = c2[1][1];
 
   IGAPointGetSizes(p,&nen,0,0);
 
   PetscScalar c_t,c;
-  IGAPointGetValue(p,V,&c_t);
-  IGAPointGetValue(p,U,&c);
+  IGAPointFormValue(p,V,&c_t);
+  IGAPointFormValue(p,U,&c);
 
   PetscReal M,dM,d2M;
   Mobility(user,c,&M,&dM,&d2M);
   ChemicalPotential(user,c,NULL,&dmu,&d2mu);
 
   PetscScalar c1[2],c2[2][2];
-  IGAPointGetGrad(p,U,&c1[0]);
-  IGAPointGetHess(p,U,&c2[0][0]);
+  IGAPointFormGrad(p,U,&c1[0]);
+  IGAPointFormHess(p,U,&c2[0][0]);
   PetscScalar c_x  = c1[0],    c_y  = c1[1];
   PetscScalar c_xx = c2[0][0], c_yy = c2[1][1];
 

File demo/CahnHilliard3D.c

   AppCtx *user = (AppCtx *)ctx;
  
   PetscScalar c,c1[3];
-  IGAPointGetValue(p,U,&c); 
-  IGAPointGetGrad(p,U,&c1[0]);
+  IGAPointFormValue(p,U,&c); 
+  IGAPointFormGrad(p,U,&c1[0]);
 
   S[0] = GinzburgLandauFreeEnergy(c,c1[0],c1[1],c1[2],user); 
   
   IGAPointGetSizes(p,&nen,0,0);
 
   PetscScalar c,c_t;
-  IGAPointGetValue(p,V,&c_t);
-  IGAPointGetValue(p,U,&c);
+  IGAPointFormValue(p,V,&c_t);
+  IGAPointFormValue(p,U,&c);
 
   PetscReal M,dM;
   Mobility(user,c,&M,&dM,NULL);
   ChemicalPotential(user,c,NULL,&dmu,NULL);
 
   PetscScalar c1[3],c2[3][3];
-  IGAPointGetGrad(p,U,&c1[0]);
-  IGAPointGetHess(p,U,&c2[0][0]);
+  IGAPointFormGrad(p,U,&c1[0]);
+  IGAPointFormHess(p,U,&c2[0][0]);
   PetscScalar c_x  = c1[0],    c_y  = c1[1],    c_z  = c1[2];
   PetscScalar c_xx = c2[0][0], c_yy = c2[1][1], c_zz = c2[2][2];
 
   IGAPointGetSizes(p,&nen,0,0);
 
   PetscScalar c_t,c;
-  IGAPointGetValue(p,V,&c_t);
-  IGAPointGetValue(p,U,&c);
+  IGAPointFormValue(p,V,&c_t);
+  IGAPointFormValue(p,U,&c);
 
   PetscReal M,dM,d2M;
   Mobility(user,c,&M,&dM,&d2M);
   ChemicalPotential(user,c,NULL,&dmu,&d2mu);
 
   PetscScalar c1[3],c2[3][3];
-  IGAPointGetGrad(p,U,&c1[0]);
-  IGAPointGetHess(p,U,&c2[0][0]);
+  IGAPointFormGrad(p,U,&c1[0]);
+  IGAPointFormHess(p,U,&c2[0][0]);
   PetscScalar c_x  = c1[0],    c_y  = c1[1],    c_z  = c1[2];
   PetscScalar c_xx = c2[0][0], c_yy = c2[1][1], c_zz = c2[2][2];
 

File demo/L2Projection.c

   IGAPointGetSizes(p,&nen,0,0);
 
   PetscReal x[3] = {0,0,0};
-  IGAPointGetPoint(p,x);
+  IGAPointFormPoint(p,x);
   PetscScalar f = Function(x[0],x[1],x[2]);
 
   const PetscReal *N;
 PetscErrorCode Error(IGAPoint p,const PetscScalar *U,PetscInt n,PetscScalar *S,void *ctx)
 {
   PetscReal x[3] = {0,0,0};
-  IGAPointGetPoint(p,x);
+  IGAPointFormPoint(p,x);
   PetscScalar f = Function(x[0],x[1],x[2]);
 
   PetscScalar u;
-  IGAPointGetValue(p,U,&u);
+  IGAPointFormValue(p,U,&u);
 
   PetscReal e = PetscAbsScalar(u - f);
   S[0] = e*e;

File demo/Laplace.c

 PetscErrorCode ErrorLaplace(IGAPoint p,const PetscScalar *U,PetscInt n,PetscScalar *S,void *ctx)
 {
   PetscScalar u;
-  IGAPointGetValue(p,U,&u);
+  IGAPointFormValue(p,U,&u);
   PetscReal e = PetscAbsScalar(u - 1.0);
   S[0] = e*e;
   return 0;

File demo/NavierStokesKorteweg2D.c

   PetscScalar u_t[3],u[3];
   PetscScalar grad_u[3][2];
   PetscScalar hess_u[3][2][2];
-  IGAPointGetValue(pnt,V,&u_t[0]);
-  IGAPointGetValue(pnt,U,&u[0]);
-  IGAPointGetGrad (pnt,U,&grad_u[0][0]);
-  IGAPointGetHess (pnt,U,&hess_u[0][0][0]);
+  IGAPointFormValue(pnt,V,&u_t[0]);
+  IGAPointFormValue(pnt,U,&u[0]);
+  IGAPointFormGrad (pnt,U,&grad_u[0][0]);
+  IGAPointFormHess (pnt,U,&hess_u[0][0][0]);
   PetscReal rho_t = u_t[0], rho = u[0];
   PetscReal rho_x = grad_u[0][0],     rho_y  = grad_u[0][1];
   PetscReal rho_xx = hess_u[0][0][0], rho_xy = hess_u[0][0][1] ;

File demo/NavierStokesVMS.c

   PetscScalar uz_xx=der2_u[2][0][0],uz_yy=der2_u[2][1][1],uz_zz=der2_u[2][2][2];
 
   PetscReal InvGradMap[3][3];
-  IGAPointGetGradMap(pnt,PETSC_NULL,&InvGradMap[0][0]);
+  IGAPointFormGradMap(pnt,PETSC_NULL,&InvGradMap[0][0]);
   PetscScalar tauM,tauC;
   Tau(InvGradMap,dt,u,nu,&tauM,&tauC);
   PetscScalar ux_s,uy_s,uz_s,p_s;
   PetscScalar uz=u[2];
 
   PetscReal InvGradMap[3][3];
-  IGAPointGetGradMap(pnt,0,&InvGradMap[0][0]);
+  IGAPointFormGradMap(pnt,0,&InvGradMap[0][0]);
   PetscScalar tauM,tauC;
   Tau(InvGradMap,dt,u,nu,&tauM,&tauC);
 

File demo/PatternFormation.c

   PetscScalar (*R)[2] = (PetscScalar (*)[2])Re;
 
   PetscScalar uv_t[2],uv_0[2],uv_1[2][2];
-  IGAPointGetValue(p,V,&uv_t[0]);
+  IGAPointFormValue(p,V,&uv_t[0]);
   if (IMPLICIT)
-    IGAPointGetValue(p,U1,&uv_0[0]);
+    IGAPointFormValue(p,U1,&uv_0[0]);
   else
-    IGAPointGetValue(p,U0,&uv_0[0]);
-  IGAPointGetGrad(p,U1,&uv_1[0][0]);
+    IGAPointFormValue(p,U0,&uv_0[0]);
+  IGAPointFormGrad(p,U1,&uv_1[0][0]);
   PetscScalar u_t = uv_t[0],    v_t = uv_t[1];
   PetscScalar u   = uv_0[0],    v   = uv_0[1];
   PetscScalar u_x = uv_1[0][0], v_x = uv_1[1][0];
   PetscReal g_u=0,g_v=0;
   if (IMPLICIT) {
     PetscScalar uv_0[2];
-    IGAPointGetValue(p,U1,&uv_0[0]);
+    IGAPointFormValue(p,U1,&uv_0[0]);
     PetscScalar u = uv_0[0];
     PetscScalar v = uv_0[1];
     f_u = alpha*(1-tau1*v*v) - tau2*v;

File demo/PhaseFieldCrystal2D.c

   AppCtx *user = (AppCtx *)ctx;
  
   PetscScalar c,c1[3];
-  IGAPointGetValue(p,U,&c); 
-  IGAPointGetGrad(p,U,&c1[0]);
+  IGAPointFormValue(p,U,&c); 
+  IGAPointFormGrad(p,U,&c1[0]);
   PetscScalar diff = c - user->cbar;
 
   S[0] = GinzburgLandauFreeEnergy(c,c1[0],c1[1],user); // Free energy
   IGAPointGetSizes(p,&nen,0,0);
 
   PetscScalar c_t,c;
-  IGAPointGetValue(p,V,&c_t);
-  IGAPointGetValue(p,U,&c);
+  IGAPointFormValue(p,V,&c_t);
+  IGAPointFormValue(p,U,&c);
 
   //PetscReal M,dM;
   //Mobility(user,c,&M,&dM,NULL);
   //ChemicalPotential(user,c,NULL,&dmu,NULL);
 
   PetscScalar c1[2],c2[2][2],c3[2][2][2];
-  IGAPointGetGrad(p,U,&c1[0]);
-  IGAPointGetHess(p,U,&c2[0][0]);
-  IGAPointGetDer3(p,U,&c3[0][0][0]);
+  IGAPointFormGrad(p,U,&c1[0]);
+  IGAPointFormHess(p,U,&c2[0][0]);
+  IGAPointFormDer3(p,U,&c3[0][0][0]);
   PetscScalar c_x   = c1[0],       c_y   = c1[1];
   PetscScalar c_xx  = c2[0][0],    c_yy  = c2[1][1];
   PetscScalar c_xxx = c3[0][0][0], c_yyy = c3[1][1][1];
   IGAPointGetSizes(p,&nen,0,0);
 
   PetscScalar c_t,c;
-  IGAPointGetValue(p,V,&c_t);
-  IGAPointGetValue(p,U,&c);
+  IGAPointFormValue(p,V,&c_t);
+  IGAPointFormValue(p,U,&c);
 
   //PetscReal M,dM,d2M;
   //Mobility(user,c,&M,&dM,&d2M);
   // ChemicalPotential(user,c,NULL,&dmu,&d2mu);
 
   PetscScalar c1[2],c2[2][2],c3[2][2][2];
-  IGAPointGetGrad(p,U,&c1[0]);
-  IGAPointGetHess(p,U,&c2[0][0]);
-  IGAPointGetDer3(p,U,&c3[0][0][0]);
+  IGAPointFormGrad(p,U,&c1[0]);
+  IGAPointFormHess(p,U,&c2[0][0]);
+  IGAPointFormDer3(p,U,&c3[0][0][0]);
   PetscScalar c_x   = c1[0],       c_y   = c1[1];
   PetscScalar c_xx  = c2[0][0],    c_yy  = c2[1][1];
   PetscScalar c_xxx = c3[0][0][0], c_yyy = c3[1][1][1];

File demo/Poisson.c

   IGAPointGetSizes(p,&nen,0,&dim);
 
   PetscReal x[3] = {0,0,0};
-  IGAPointGetPoint(p,x);
+  IGAPointFormPoint(p,x);
 
   const PetscReal *N0,*N1;
   IGAPointGetShapeFuns(p,0,&N0);

File demo/ShallowWater.c

   PetscReal g  = user->gravity;
 
   PetscScalar s_t[3],s[3],grad_s[3][2];
-  IGAPointGetValue(p,V,&s_t[0]);
-  IGAPointGetValue(p,U,&s[0]);
-  IGAPointGetGrad (p,U,&grad_s[0][0]);
+  IGAPointFormValue(p,V,&s_t[0]);
+  IGAPointFormValue(p,U,&s[0]);
+  IGAPointFormGrad (p,U,&grad_s[0][0]);
 
   PetscScalar h_t  = s_t[0], h  = s[0];
   PetscScalar hu_t = s_t[1], hu = s[1], u = hu/h;

File include/petiga.h

 
 PETSC_EXTERN PetscErrorCode IGAPointInterpolate(IGAPoint point,PetscInt ider,const PetscScalar U[],PetscScalar u[]);
 
-PETSC_EXTERN PetscErrorCode IGAPointGetPoint(IGAPoint p,PetscReal x[]);
-PETSC_EXTERN PetscErrorCode IGAPointGetGradMap(IGAPoint p,PetscReal map[],PetscReal inv[]);
-PETSC_EXTERN PetscErrorCode IGAPointGetValue(IGAPoint p,const PetscScalar U[],PetscScalar u[]);
-PETSC_EXTERN PetscErrorCode IGAPointGetGrad (IGAPoint p,const PetscScalar U[],PetscScalar u[]);
-PETSC_EXTERN PetscErrorCode IGAPointGetHess (IGAPoint p,const PetscScalar U[],PetscScalar u[]);
-PETSC_EXTERN PetscErrorCode IGAPointGetDel2 (IGAPoint p,const PetscScalar U[],PetscScalar u[]);
-PETSC_EXTERN PetscErrorCode IGAPointGetDer3(IGAPoint p,const PetscScalar U[],PetscScalar u[]);
+PETSC_EXTERN PetscErrorCode IGAPointFormPoint    (IGAPoint p,PetscReal x[]);
+PETSC_EXTERN PetscErrorCode IGAPointFormGradMap  (IGAPoint p,PetscReal map[],PetscReal inv[]);
+PETSC_EXTERN PetscErrorCode IGAPointFormShapeFuns(IGAPoint p,PetscInt der,PetscReal N[]);
+PETSC_EXTERN PetscErrorCode IGAPointFormValue(IGAPoint p,const PetscScalar U[],PetscScalar u[]);
+PETSC_EXTERN PetscErrorCode IGAPointFormGrad (IGAPoint p,const PetscScalar U[],PetscScalar u[]);
+PETSC_EXTERN PetscErrorCode IGAPointFormHess (IGAPoint p,const PetscScalar U[],PetscScalar u[]);
+PETSC_EXTERN PetscErrorCode IGAPointFormDel2 (IGAPoint p,const PetscScalar U[],PetscScalar u[]);
+PETSC_EXTERN PetscErrorCode IGAPointFormDer3 (IGAPoint p,const PetscScalar U[],PetscScalar u[]);
 
 PETSC_EXTERN PetscErrorCode IGAPointGetWorkVec(IGAPoint point,PetscScalar *V[]);
 PETSC_EXTERN PetscErrorCode IGAPointGetWorkMat(IGAPoint point,PetscScalar *M[]);

File src/petigapoint.c

 {
   PetscFunctionBegin;
   PetscValidPointer(point,1);
-  PetscValidPointer(basisfuns,2);
+  PetscValidPointer(basisfuns,3);
   if (PetscUnlikely(der < 0 || der >= (PetscInt)(sizeof(point->basis)/sizeof(PetscReal*))))
     SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,
             "Requested derivative must be in range [0,%d], got %D",
 {
   PetscFunctionBegin;
   PetscValidPointer(point,1);
-  PetscValidPointer(shapefuns,2);
+  PetscValidPointer(shapefuns,3);
   if (PetscUnlikely(der < 0 || der >= (PetscInt)(sizeof(point->shape)/sizeof(PetscReal*))))
     SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,
             "Requested derivative must be in range [0,%d], got %D",
 EXTERN_C_END
 
 #undef  __FUNCT__
-#define __FUNCT__ "IGAPointGetPoint"
-PetscErrorCode IGAPointGetPoint(IGAPoint p,PetscReal x[])
+#define __FUNCT__ "IGAPointFormPoint"
+PetscErrorCode IGAPointFormPoint(IGAPoint p,PetscReal x[])
 {
   PetscFunctionBegin;
   PetscValidPointer(p,1);
 }
 
 #undef  __FUNCT__
-#define __FUNCT__ "IGAPointGetGradMap"
-PetscErrorCode IGAPointGetGradMap(IGAPoint p,PetscReal map[],PetscReal inv[])
+#define __FUNCT__ "IGAPointFormGradMap"
+PetscErrorCode IGAPointFormGradMap(IGAPoint p,PetscReal map[],PetscReal inv[])
 {
   PetscReal *F = map;
   PetscReal *G = inv;
 }
 
 #undef  __FUNCT__
-#define __FUNCT__ "IGAPointGetValue"
-PetscErrorCode IGAPointGetValue(IGAPoint p,const PetscScalar U[],PetscScalar u[])
+#define __FUNCT__ "IGAPointFormShapeFuns"
+PetscErrorCode IGAPointFormShapeFuns(IGAPoint point,PetscInt der,PetscReal N[])
+{
+  PetscInt       i,n;
+  PetscErrorCode ierr;
+  PetscFunctionBegin;
+  PetscValidPointer(point,1);
+  PetscValidRealPointer(N,3);
+  if (PetscUnlikely(der < 0 || der >= (PetscInt)(sizeof(point->shape)/sizeof(PetscReal*))))
+    SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,
+             "Requested derivative must be in range [0,%d], got %D",
+             (int)(sizeof(point->shape)/sizeof(PetscReal*)-1),der);
+  for (i=0,n=point->nen; i<der; i++) n *= point->dim;
+  ierr = PetscMemcpy(N,point->shape[der],n*sizeof(PetscReal));CHKERRQ(ierr);
+  PetscFunctionReturn(0);
+}
+
+#undef  __FUNCT__
+#define __FUNCT__ "IGAPointFormValue"
+PetscErrorCode IGAPointFormValue(IGAPoint p,const PetscScalar U[],PetscScalar u[])
 {
   PetscFunctionBegin;
   PetscValidPointer(p,1);
 }
 
 #undef  __FUNCT__
-#define __FUNCT__ "IGAPointGetGrad"
-PetscErrorCode IGAPointGetGrad(IGAPoint p,const PetscScalar U[],PetscScalar u[])
+#define __FUNCT__ "IGAPointFormGrad"
+PetscErrorCode IGAPointFormGrad(IGAPoint p,const PetscScalar U[],PetscScalar u[])
 {
   PetscFunctionBegin;
   PetscValidPointer(p,1);
 }
 
 #undef  __FUNCT__
-#define __FUNCT__ "IGAPointGetHess"
-PetscErrorCode IGAPointGetHess(IGAPoint p,const PetscScalar U[],PetscScalar u[])
+#define __FUNCT__ "IGAPointFormHess"
+PetscErrorCode IGAPointFormHess(IGAPoint p,const PetscScalar U[],PetscScalar u[])
 {
   PetscFunctionBegin;
   PetscValidPointer(p,1);
 }
 
 #undef  __FUNCT__
-#define __FUNCT__ "IGAPointGetDel2"
-PetscErrorCode IGAPointGetDel2(IGAPoint p,const PetscScalar U[],PetscScalar u[])
+#define __FUNCT__ "IGAPointFormDel2"
+PetscErrorCode IGAPointFormDel2(IGAPoint p,const PetscScalar U[],PetscScalar u[])
 {
   PetscFunctionBegin;
   PetscValidPointer(p,1);
 }
 
 #undef  __FUNCT__
-#define __FUNCT__ "IGAPointGetDer3"
-PetscErrorCode IGAPointGetDer3(IGAPoint p,const PetscScalar U[],PetscScalar u[])
+#define __FUNCT__ "IGAPointFormDer3"
+PetscErrorCode IGAPointFormDer3(IGAPoint p,const PetscScalar U[],PetscScalar u[])
 {
   PetscFunctionBegin;
   PetscValidPointer(p,1);

File test/Test_SNES_2D.c

   PetscInt nen=p->nen;
 
   PetscReal xy[2];
-  IGAPointGetPoint(p,xy);
+  IGAPointFormPoint(p,xy);
   PetscReal x = xy[0];
   PetscReal y = xy[1];
 
   PetscScalar u0[4],u1[4][2];
-  IGAPointGetValue(p,Ue,&u0[0]);
-  IGAPointGetGrad (p,Ue,&u1[0][0]);
+  IGAPointFormValue(p,Ue,&u0[0]);
+  IGAPointFormGrad (p,Ue,&u1[0][0]);
   PetscScalar PETSC_UNUSED u = u0[0], u_x = u1[0][0], u_y = u1[0][1];
   PetscScalar PETSC_UNUSED v = u0[1], v_x = u1[1][0], v_y = u1[1][1];
   PetscScalar PETSC_UNUSED w = u0[2], w_x = u1[2][0], w_y = u1[2][1];
   PetscScalar PETSC_UNUSED r = u0[3], r_x = u1[3][0], r_y = u1[3][1];
 
-  const PetscReal *N0, (*N1)[2];
+  /*const PetscReal *N0, (*N1)[2];
   IGAPointGetShapeFuns(p,0,(const PetscReal **)&N0);
-  IGAPointGetShapeFuns(p,1,(const PetscReal **)&N1);
+  IGAPointGetShapeFuns(p,1,(const PetscReal **)&N1);*/
+  PetscReal N0[nen], N1[nen][2];
+  IGAPointFormShapeFuns(p,0,&N0[0]);
+  IGAPointFormShapeFuns(p,1,&N1[0][0]);
 
   PetscInt a;
   for (a=0; a<nen; a++) {
   PetscInt nen=p->nen;
 
   PetscScalar u0[4];
-  IGAPointGetValue(p,Ue,&u0[0]);
+  IGAPointFormValue(p,Ue,&u0[0]);
   PetscScalar PETSC_UNUSED r = u0[3];
 
   const PetscReal *N0, (*N1)[2];