Nathan Collier avatar Nathan Collier committed 3696b6b

working collocation code

Comments (0)

Files changed (2)

   PetscInt nen,dim;
   IGAColPointGetSizes(p,&nen,0,&dim);
 
+  PetscInt Nb[3] = {0,0,0};
+  Nb[0] = p->parent->basis[0]->nnp;
+  Nb[1] = p->parent->basis[1]->nnp;
+  Nb[2] = p->parent->basis[2]->nnp;
+
   const PetscReal *N0,(*N1)[dim],(*N2)[dim][dim];
   IGAColPointGetBasisFuns(p,0,(const PetscReal**)&N0);
   IGAColPointGetBasisFuns(p,1,(const PetscReal**)&N1);
   IGAColPointGetBasisFuns(p,2,(const PetscReal**)&N2);
   
   PetscInt a,i;
-  for (a=0; a<nen; a++) 
+  PetscReal n[3] = {0,0,0};
+  PetscBool Dirichlet=PETSC_FALSE,Neumann=PETSC_FALSE;
+  for (i=0; i<dim; i++) if (p->ID[i] == 0) Dirichlet=PETSC_TRUE;
+  if (!Dirichlet) { 
     for (i=0; i<dim; i++) {
-      K[a] += -N2[a][i][i];
+      if (p->ID[i] == Nb[i]-1) {
+	Neumann=PETSC_TRUE;
+	n[i] = 1;
+	i=dim;
+      }
     }
-      
+  }
+
+  if(Dirichlet){
+    for (a=0; a<nen; a++) K[a] += N0[a];
+    F[0] = 1.0;
+  }else if(Neumann){
+    for (a=0; a<nen; a++) 
+      for (i=0; i<dim; i++) 
+	K[a] += N1[a][i]*n[i];    
+    F[0] = 0.0;
+  }else{
+    for (a=0; a<nen; a++) 
+      for (i=0; i<dim; i++) 
+	K[a] += -N2[a][i][i];
+  }
   return 0;
 }
 
   PetscInt dim;
   PetscInt nsd;
 
-  PetscReal *weight;   /*   [1]   */
-  PetscReal *detJac;   /*   [1]   */
+  PetscReal *weight;   /*      */
+  PetscReal *detJac;   /*      */
 
-  PetscReal *point;    /*   [1][dim] */
-  PetscReal *scale;    /*   [1][dim] */
+  PetscReal *point;    /*   [dim] */
+  PetscReal *scale;    /*   [dim] */
   
-  PetscReal *basis[4]; /*0: [1][nen] */
-                       /*1: [1][nen][dim] */
-                       /*2: [1][nen][dim][dim] */
-                       /*3: [1][nen][dim][dim][dim] */
-  PetscReal *gradX[2]; /*0: [1][nsd][dim] */
-                       /*1: [1][dim][nsd] */
-  PetscReal *shape[4]; /*0: [1][nen]  */
-                       /*1: [1][nen][nsd] */
-                       /*2: [1][nen][nsd][nsd] */
-                       /*3: [1][nen][nsd][nsd][nsd] */
+  PetscReal *basis[4]; /*0: [nen] */
+                       /*1: [nen][dim] */
+                       /*2: [nen][dim][dim] */
+                       /*3: [nen][dim][dim][dim] */
+  PetscReal *gradX[2]; /*0: [nsd][dim] */
+                       /*1: [dim][nsd] */
+  PetscReal *shape[4]; /*0: [nen]  */
+                       /*1: [nen][nsd] */
+                       /*2: [nen][nsd][nsd] */
+                       /*3: [nen][nsd][nsd][nsd] */
 
   IGAElement  parent;
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.