From 6c327a840aff6006af56ee1f91dfe9391be3fe2f Mon Sep 17 00:00:00 2001
From: Bastien Gorissen <bastien.gorissen@cenaero.be>
Date: Fri, 10 Feb 2012 14:45:49 +0000
Subject: [PATCH] Only accepts power of two as order for importing structured
 CGNS meshes.

---
 Common/Options.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Common/Options.cpp b/Common/Options.cpp
index 42c969b9a5..2f22ee4e80 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -5144,7 +5144,15 @@ double opt_mesh_hom_no_metric(OPT_ARGS_NUM)
 double opt_mesh_cgns_import_order(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET) {
-    CTX::instance()->mesh.cgnsImportOrder = (int)val;
+    int value = (int)val; 
+    double order = val;
+    while(order >= 2.0) {
+      order = order / 2.0;
+    }
+    
+    if (order != 1.0)
+      value = 1;
+    CTX::instance()->mesh.cgnsImportOrder = value;
   }
   return CTX::instance()->mesh.cgnsImportOrder;
 }
-- 
GitLab