Commits

Lisandro Dalcin committed 05b4b56

Add IGAElement->sizes and remove IGABasis->nnp

  • Participants
  • Parent commits e16ea00

Comments (0)

Files changed (3)

   PetscInt refct;
   /**/
   PetscInt  nel;      /* number of elements */
-  PetscInt  nnp;      /* number of basis functions */
   PetscInt  nqp;      /* number of quadrature points */
   PetscInt  nen;      /* number of local basis functions */
   PetscInt  p,d;      /* polynomial order, last derivative index */
 struct _n_IGAElement {
   PetscInt refct;
   /**/
-  PetscInt start[3];
-  PetscInt width[3];
-  PetscInt ID[3];
+  PetscInt  start[3];
+  PetscInt  width[3];
+  PetscInt  sizes[3];
+  PetscInt  ID[3];
   /**/
   PetscInt count;
   PetscInt index;

src/petigabasis.c

   if (!basis) PetscFunctionReturn(0);
   PetscValidPointer(basis,1);
   basis->nel = 0;
-  basis->nnp = 0;
   basis->nqp = 0;
   basis->nen = 0;
   basis->p   = 0;
 #define __FUNCT__ "IGABasisInitQuadrature"
 PetscErrorCode IGABasisInitQuadrature(IGABasis basis,IGAAxis axis,IGARule rule,PetscInt d)
 {
-  PetscInt       p,nnp;
+  PetscInt       p;
   const PetscInt *span;
   const PetscReal*U,*X,*W;
   PetscInt       iel,nel;
   W   = rule->weight;
 
   nel  = axis->nel;
-  nnp  = axis->nnp;
   span = axis->span;
   nen  = p+1;
   ndr  = d+1;
   ierr = IGABasisReset(basis);CHKERRQ(ierr);
 
   basis->nel    = nel;
-  basis->nnp    = nnp;
   basis->nqp    = nqp;
   basis->nen    = nen;
   basis->p      = p;
 #define __FUNCT__ "IGABasisInitCollocation"
 PetscErrorCode IGABasisInitCollocation(IGABasis basis,IGAAxis axis,PetscInt d)
 {
-  PetscInt       p,n,nnp;
+  PetscInt       p,n;
   const PetscReal*U;
   PetscInt       iel,nel;
   PetscInt       iqp,nqp;
   U = axis->U;
 
   nel  = axis->nnp;
-  nnp  = axis->nnp;
   nqp  = 1;
   nen  = p+1;
   ndr  = d+1;
   ierr = IGABasisReset(basis);CHKERRQ(ierr);
 
   basis->nel    = nel;
-  basis->nnp    = nnp;
   basis->nqp    = nqp;
   basis->nen    = nen;
   basis->p      = p;
 {
   PetscInt *start;
   PetscInt *width;
+  PetscInt *sizes;
   PetscErrorCode ierr;
   PetscFunctionBegin;
   PetscValidPointer(element,1);
   if (!element->collocation) {
     start = iga->elem_start;
     width = iga->elem_width;
+    sizes = iga->elem_sizes;
     element->BD = iga->elem_basis;
   } else {
     start = iga->node_lstart;
     width = iga->node_lwidth;
+    sizes = iga->node_sizes;
     element->BD = iga->node_basis;
   }
   { /* */
     PetscInt i,dim = element->dim;
-    PetscInt nel=1,nqp=1,nen=1;
+    PetscInt nel=1,nen=1,nqp=1;
     for (i=0; i<dim; i++) {
       element->start[i] = start[i];
       element->width[i] = width[i];
+      element->sizes[i] = sizes[i];
       nel *= element->width[i];
+      nen *= element->BD[i]->nen;
       nqp *= element->BD[i]->nqp;
-      nen *= element->BD[i]->nen;
     }
     for (i=dim; i<3; i++) {
       element->start[i] = 0;
       element->width[i] = 1;
+      element->sizes[i] = 1;
     }
     element->index = -1;
     element->count = nel;
+    element->nen   = nen;
     element->nqp   = nqp;
-    element->nen   = nen;
   }
   { /* */
     PetscInt dim = element->dim;
     PetscInt nen = element->nen;
     PetscInt nqp = element->nqp;
 
+    /* */
+
     ierr = PetscMalloc1(nen,PetscInt,&element->mapping);CHKERRQ(ierr);
     ierr = PetscMalloc1(nen*nsd,PetscReal,&element->geometryX);CHKERRQ(ierr);
     ierr = PetscMalloc1(nen,PetscReal,&element->rationalW);CHKERRQ(ierr);
   element->nflux = 0;
   if (!element->collocation) {
     IGAAxis  *AX = element->parent->axis;
-    IGABasis *BD = element->BD;
     PetscInt *ID = element->ID;
     PetscInt i,dim = element->dim;
     for (i=0; i<dim; i++) {
       PetscBool w = AX[i]->periodic;
-      PetscInt  e = BD[i]->nel-1; /* last element */
+      PetscInt  e = element->sizes[i]-1; /* last element */
       if (ID[i] == 0 && !w) BuildFix(element,i,0);
       if (ID[i] == e && !w) BuildFix(element,i,1);
     }
       IGAAxis  *AX = element->parent->axis;
       PetscInt i,dim = element->dim;
       for (i=0; i<dim; i++) {
-	PetscBool w = AX[i]->periodic;
-	PetscInt  n = AX[i]->nnp-1; /* last node */
-	A0[i] = 0; if (!w) A1[i] = n;
+        PetscBool w = AX[i]->periodic;
+        PetscInt  n = element->sizes[i]-1; /* last node */
+        A0[i] = 0; if (!w) A1[i] = n;
       }
     }
     {