Lisandro Dalcin avatar Lisandro Dalcin committed 6cb9ffa

Fix periodicity with low element counts

Comments (0)

Files changed (2)

    IGACreateMat - Creates a matrix with the correct parallel layout
    required for computing a matrix using the discretization
    information provided in the IGA.
-   
+
    Collective on IGA
 
    Input Parameter:
   if (aij || baij || sbaij) {
     PetscInt nbs = (baij||sbaij) ? n : n*bs;
     PetscInt Nbs = (baij||sbaij) ? N : N*bs;
-    PetscInt *dnz = 0, dmax = nbs;
-    PetscInt *onz = 0, omax = Nbs - nbs;
+    PetscInt *dnz = 0, *onz = 0;
     ierr = MatPreallocateInitialize(comm,nbs,nbs,dnz,onz);CHKERRQ(ierr);
     {
       PetscInt i,j,k;
                 ierr = MatPreallocateSymmetricSet(row,count,indices,dnz,onz);CHKERRQ(ierr);
               }
             }
-      for (i=0; i<nbs; i++) {
-        dnz[i] = PetscMin(dnz[i],dmax);
-        onz[i] = PetscMin(onz[i],omax);
+      if (N < maxnnz) {
+        PetscInt dmaxnz = nbs;
+        PetscInt omaxnz = Nbs - nbs;
+        for (i=0; i<nbs; i++) {
+          dnz[i] = PetscMin(dnz[i],dmaxnz);
+          onz[i] = PetscMin(onz[i],omaxnz);
+        }
       }
       if (aij) {
         ierr = MatSeqAIJSetPreallocation(A,0,dnz);CHKERRQ(ierr);
 #define __FUNCT__ "main"
 int main(int argc, char *argv[]) {
 
-  PetscInt       i,dim,dof;
+  PetscInt       dim,dof;
   IGA            iga;
   Vec            v;
   Mat            A;
   if (dim < 1) {ierr = IGASetDim(iga,dim=3);CHKERRQ(ierr);}
   ierr = IGAGetDof(iga,&dof);CHKERRQ(ierr);
   if (dof < 1) {ierr = IGASetDof(iga,dof=1);CHKERRQ(ierr);}
-  for (i=0; i<dim; i++) {
-    IGAAxis axis;
-    PetscInt p,m;
-    PetscReal *U;
-    ierr = IGAGetAxis(iga,i,&axis);CHKERRQ(ierr);
-    ierr = IGAAxisGetDegree(axis,&p);CHKERRQ(ierr);
-    ierr = IGAAxisGetKnots(axis,&m,&U);CHKERRQ(ierr);
-    if (p < 1)     {ierr = IGAAxisSetDegree(axis,p=2);CHKERRQ(ierr);}
-    if (m < 2*p+1) {ierr = IGAAxisInitUniform(axis,16,0.0,1.0,p-1);CHKERRQ(ierr);}
-  }
   ierr = IGASetUp(iga);CHKERRQ(ierr);
 
   ierr = IGACreateElemDM(iga,dof,&dm);CHKERRQ(ierr);
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.