Index: /issm/trunk/src/c/objects/BamgOpts.cpp
===================================================================
--- /issm/trunk/src/c/objects/BamgOpts.cpp	(revision 3212)
+++ /issm/trunk/src/c/objects/BamgOpts.cpp	(revision 3213)
@@ -1,3 +1,4 @@
 #include "stdio.h"
+#include "../shared/shared.h"
 #include "./BamgOpts.h"
 
@@ -31,2 +32,24 @@
 
 }
+
+void BamgOptsCheck(BamgOpts* bamgopts){
+
+	int i;
+
+	if (bamgopts->coef==0) throw ErrorException(__FUNCT__,exprintf("'coef' should be positive"));
+	if (bamgopts->maxsubdiv<1) throw ErrorException(__FUNCT__,exprintf("'maxsubdiv' should be >=1"));
+	if (bamgopts->Hessiantype!=0  && bamgopts->Hessiantype!=1) throw ErrorException(__FUNCT__,exprintf("'Hessiantype' supported options are 0 and 1"));
+	if (bamgopts->Metrictype!=0   && bamgopts->Metrictype!=1 && bamgopts->Metrictype!=2) throw ErrorException(__FUNCT__,exprintf("'Metrictype' supported options are 0, 1 and 2"));
+	if (bamgopts->KeepVertices!=0 && bamgopts->KeepVertices!=1) throw ErrorException(__FUNCT__,exprintf("'KeepVertices' supported options are 0 and 1"));
+	if (bamgopts->renumber!=0     && bamgopts->renumber!=1   && bamgopts->renumber!=2)   throw ErrorException(__FUNCT__,exprintf("'renumber' supported options are 0, 1 and 2"));
+	if (bamgopts->errg<0) throw ErrorException(__FUNCT__,exprintf("'errg' option should be >0"));
+	if (bamgopts->nbjacobi<=0) throw ErrorException(__FUNCT__,exprintf("'nbjacobi' option should be >0"));
+	if (bamgopts->NbSmooth<=0) throw ErrorException(__FUNCT__,exprintf("'NbSmooth' option should be >0"));
+	if (bamgopts->maxnbv<3) throw ErrorException(__FUNCT__,exprintf("'maxnbv' option should be >3"));
+	if (bamgopts->hmin<=0) throw ErrorException(__FUNCT__,exprintf("'hmin' option should be >0"));
+	if (bamgopts->hmax<=0 || bamgopts->hmax<bamgopts->hmin) throw ErrorException(__FUNCT__,exprintf("'hmax' option should be between 0 and hmin=%g",bamgopts->hmin));
+	if (bamgopts->anisomax<1) throw ErrorException(__FUNCT__,exprintf("'anisomax' option should be >=1"));
+	if (bamgopts->gradation<1) throw ErrorException(__FUNCT__,exprintf("'gradation' option should be >=1"));
+	for (i=0;i<bamgopts->numfields;i++) {if (bamgopts->err[i]<=0) throw ErrorException(__FUNCT__,exprintf("'err' option should be >0"));};
+
+}
Index: /issm/trunk/src/c/objects/BamgOpts.h
===================================================================
--- /issm/trunk/src/c/objects/BamgOpts.h	(revision 3212)
+++ /issm/trunk/src/c/objects/BamgOpts.h	(revision 3213)
@@ -38,3 +38,5 @@
 void BamgOptsInit(BamgOpts* bamgopts);
 
+void BamgOptsCheck(BamgOpts* bamgopts);
+
 #endif
