Commits

Lisandro Dalcin committed 348f7ba

Add IGAOptionsAlias()

Comments (0)

Files changed (2)

 PETSC_EXTERN PetscErrorCode IGAPrependOptionsPrefix(IGA iga,const char prefix[]);
 PETSC_EXTERN PetscErrorCode IGAAppendOptionsPrefix(IGA iga,const char prefix[]);
 PETSC_EXTERN PetscErrorCode IGASetFromOptions(IGA iga);
+PETSC_EXTERN PetscErrorCode IGAOptionsAlias(const char name[],const char defval[],const char alias[]);
 
 PETSC_EXTERN PetscErrorCode IGALoad(IGA iga,PetscViewer viewer);
 PETSC_EXTERN PetscErrorCode IGASave(IGA iga,PetscViewer viewer);
 }
 
 #undef  __FUNCT__
+#define __FUNCT__ "IGAOptionsAlias"
+PetscErrorCode IGAOptionsAlias(const char name[],const char defval[],const char alias[])
+{
+  char           value[4096]= {0};
+  PetscBool      flag = PETSC_FALSE;
+  PetscErrorCode ierr;
+  PetscFunctionBegin;
+  PetscValidCharPointer(name,1);
+  PetscValidCharPointer(alias,3);
+  ierr = PetscOptionsHasName(NULL,name,&flag);CHKERRQ(ierr);
+  if (flag) {
+    ierr = PetscOptionsGetString(NULL,name,value,sizeof(value),&flag);CHKERRQ(ierr);
+    ierr = PetscOptionsSetValue(alias,value);CHKERRQ(ierr);
+  } else if (defval) {
+    ierr = PetscOptionsHasName(NULL,alias,&flag);CHKERRQ(ierr);
+    if (!flag) {ierr = PetscOptionsSetValue(alias,defval);CHKERRQ(ierr);}
+  }
+  PetscFunctionReturn(0);
+}
+
+#undef  __FUNCT__
 #define __FUNCT__ "IGACreateSubComms1D"
 PetscErrorCode IGACreateSubComms1D(IGA iga,MPI_Comm subcomms[])
 {