1. Lisandro Dalcin
  2. PetIGA

Commits

Lisandro Dalcin  committed 04b7ac7

Add IGAGet{Elem|Geom|Node}DM()

  • Participants
  • Parent commits 4e0b4df
  • Branches default

Comments (0)

Files changed (2)

File include/petiga.h

View file
  • Ignore whitespace
 PETSC_EXTERN PetscErrorCode IGACreateGeomDM(IGA iga,PetscInt bs,DM *dm);
 PETSC_EXTERN PetscErrorCode IGACreateNodeDM(IGA iga,PetscInt bs,DM *dm);
 
+PETSC_EXTERN PetscErrorCode IGAGetElemDM(IGA iga,DM *dm);
+PETSC_EXTERN PetscErrorCode IGAGetGeomDM(IGA iga,DM *dm);
+PETSC_EXTERN PetscErrorCode IGAGetNodeDM(IGA iga,DM *dm);
+
 PETSC_EXTERN PetscErrorCode IGASetVecType(IGA iga,const VecType vectype);
 PETSC_EXTERN PetscErrorCode IGASetMatType(IGA iga,const MatType mattype);
 

File src/petiga.c

View file
  • Ignore whitespace
 }
 
 #undef  __FUNCT__
+#define __FUNCT__ "IGAGetElemDM"
+PetscErrorCode IGAGetElemDM(IGA iga,DM *dm)
+{
+  PetscErrorCode ierr;
+  PetscFunctionBegin;
+  PetscValidHeaderSpecific(iga,IGA_CLASSID,1);
+  PetscValidPointer(dm,3);
+  IGACheckSetUp(iga,1);
+  if (!iga->elem_dm) {ierr = IGACreateElemDM(iga,iga->dof,&iga->elem_dm);CHKERRQ(ierr);}
+  *dm = iga->elem_dm;
+  PetscFunctionReturn(0);
+}
+
+#undef  __FUNCT__
+#define __FUNCT__ "IGAGetGeomDM"
+PetscErrorCode IGAGetGeomDM(IGA iga,DM *dm)
+{
+  PetscErrorCode ierr;
+  PetscFunctionBegin;
+  PetscValidHeaderSpecific(iga,IGA_CLASSID,1);
+  PetscValidPointer(dm,3);
+  IGACheckSetUp(iga,1);
+  if (!iga->geom_dm) {ierr = IGACreateGeomDM(iga,iga->dof,&iga->geom_dm);CHKERRQ(ierr);}
+  *dm = iga->geom_dm;
+  PetscFunctionReturn(0);
+}
+
+#undef  __FUNCT__
+#define __FUNCT__ "IGAGetNodeDM"
+PetscErrorCode IGAGetNodeDM(IGA iga,DM *dm)
+{
+  PetscInt       i;
+  PetscErrorCode ierr;
+  PetscFunctionBegin;
+  PetscValidHeaderSpecific(iga,IGA_CLASSID,1);
+  PetscValidPointer(dm,3);
+  IGACheckSetUp(iga,1);
+  if (!iga->node_dm) {
+    ierr = IGACreateNodeDM(iga,iga->dof,&iga->node_dm);CHKERRQ(ierr);
+    if (iga->fieldname)
+      for (i=0; i<iga->dof; i++)
+        {ierr = DMDASetFieldName(iga->node_dm,i,iga->fieldname[i]);CHKERRQ(ierr);}
+  }
+  *dm = iga->node_dm;
+  PetscFunctionReturn(0);
+}
+
+#undef  __FUNCT__
 #define __FUNCT__ "IGASetUp_Stage1"
 PetscErrorCode IGASetUp_Stage1(IGA iga)
 {