]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Introduce DEAL_II_OPENCASCADE_VERSION_GTE 13845/head
authorMarc Fehling <mafehling.git@gmail.com>
Sat, 28 May 2022 01:15:44 +0000 (19:15 -0600)
committerMarc Fehling <mafehling.git@gmail.com>
Sat, 28 May 2022 04:20:39 +0000 (22:20 -0600)
cmake/modules/FindOPENCASCADE.cmake
doc/doxygen/options.dox.in
include/deal.II/base/config.h.in
source/opencascade/manifold_lib.cc
source/opencascade/utilities.cc

index 0e2acc73eeb18b45ad7d0e31b266fc5772b40904..f8ce890ba4ecb9b65760f6346df273bf5ef9cfe8 100644 (file)
@@ -26,6 +26,9 @@
 #   OPENCASCADE_INCLUDE_DIRS
 #   OPENCASCADE_LIBRARIES
 #   OPENCASCADE_VERSION
+#   OPENCASCADE_VERSION_MAJOR
+#   OPENCASCADE_VERSION_MINOR
+#   OPENCASCADE_VERSION_SUBMINOR
 #
 
 
@@ -49,6 +52,18 @@ IF(EXISTS ${OPENCASCADE_INCLUDE_DIR}/Standard_Version.hxx)
     "#define OCC_VERSION_COMPLETE.*\"(.*)\"" "\\1"
     OPENCASCADE_VERSION "${OPENCASCADE_VERSION}"
     )
+  STRING(REGEX REPLACE
+    "^([0-9]+).*$" "\\1"
+    OPENCASCADE_VERSION_MAJOR "${OPENCASCADE_VERSION}"
+    )
+  STRING(REGEX REPLACE
+    "^[0-9]+\\.([0-9]+).*$" "\\1"
+    OPENCASCADE_VERSION_MINOR "${OPENCASCADE_VERSION}"
+    )
+  STRING(REGEX REPLACE
+    "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1"
+    OPENCASCADE_VERSION_SUBMINOR "${OPENCASCADE_VERSION}"
+    )
 ENDIF()
 
 # These seem to be pretty much the only required ones.
index 308f28dd3c1c24cd0c371477a58e19db0533aa14..ac58e22a2ed8e45116ea37d7d7f20d37e83f4251 100644 (file)
@@ -213,6 +213,10 @@ PREDEFINED             = DOXYGEN=1 \
                          DEAL_II_MPI_VERSION_MINOR=0 \
                          DEAL_II_WITH_MUPARSER=1 \
                          DEAL_II_WITH_OPENCASCADE=1 \
+                         DEAL_II_OPENCASCADE_VERSION_MAJOR=7 \
+                         DEAL_II_OPENCASCADE_VERSION_MINOR=6 \
+                         DEAL_II_OPENCASCADE_VERSION_SUBMINOR=0 \
+                         DEAL_II_OPENCASCADE_VERSION_GTE=1 \
                          DEAL_II_WITH_P4EST=1 \
                          DEAL_II_P4EST_VERSION_MAJOR=2 \
                          DEAL_II_P4EST_VERSION_MINOR=0 \
index ae16c5d95649f91f3e3efc347536fe25bd3020d1..706fb4a28b14563504da29870e5b4602d25a49e3 100644 (file)
 #  define DEAL_II_GMSH_EXECUTABLE_PATH "@GMSH_EXECUTABLE@"
 #endif
 
+/**
+ * OpenCASCADE:
+ */
+
+#ifdef DEAL_II_WITH_OPENCASCADE
+#  define DEAL_II_OPENCASCADE_VERSION_MAJOR @OPENCASCADE_VERSION_MAJOR@
+#  define DEAL_II_OPENCASCADE_VERSION_MINOR @OPENCASCADE_VERSION_MINOR@
+#  define DEAL_II_OPENCASCADE_VERSION_SUBMINOR @OPENCASCADE_VERSION_SUBMINOR@
+
+#  define DEAL_II_OPENCASCADE_VERSION_GTE(major,minor,subminor) \
+ ((DEAL_II_OPENCASCADE_VERSION_MAJOR * 10000 + \
+    DEAL_II_OPENCASCADE_VERSION_MINOR * 100 + \
+      DEAL_II_OPENCASCADE_VERSION_SUBMINOR) \
+    >=  \
+    (major)*10000 + (minor)*100 + (subminor))
+#endif
+
 /*
  * p4est:
  */
index 69bc38b58a9b8c63e39cc5d9ba6761ee7d619621..af14a8c6e349cb63e04a5b5ee4c83110431f6a1a 100644 (file)
@@ -14,6 +14,8 @@
 // ---------------------------------------------------------------------
 
 
+#include <deal.II/base/config.h>
+
 #include <deal.II/opencascade/manifold_lib.h>
 
 #ifdef DEAL_II_WITH_OPENCASCADE
@@ -28,9 +30,8 @@
 #  include <GCPnts_AbscissaPoint.hxx>
 #  include <ShapeAnalysis_Curve.hxx>
 #  include <ShapeAnalysis_Surface.hxx>
-#  include <Standard_Version.hxx>
 #  include <TopoDS.hxx>
-#  if (OCC_VERSION_MAJOR < 7)
+#  if !DEAL_II_OPENCASCADE_VERSION_GTE(7, 0, 0)
 #    include <Handle_Adaptor3d_HCurve.hxx>
 #  endif
 
index dbb5614e902872a8b585bd8ee1f3be1d26dfe3fa..d955df987b33b780301c268992e8500992c8e976 100644 (file)
@@ -13,6 +13,8 @@
 //
 // ---------------------------------------------------------------------
 
+#include <deal.II/base/config.h>
+
 #include <deal.II/opencascade/utilities.h>
 
 #ifdef DEAL_II_WITH_OPENCASCADE
@@ -27,7 +29,6 @@
 #  include <STEPControl_Controller.hxx>
 #  include <STEPControl_Reader.hxx>
 #  include <STEPControl_Writer.hxx>
-#  include <Standard_Version.hxx>
 #  include <TopExp_Explorer.hxx>
 #  include <TopoDS.hxx>
 #  include <TopoDS_Edge.hxx>
 #  include <cstdio>
 #  include <iostream>
 #  include <set>
-#  if (OCC_VERSION_MAJOR < 7)
-#    include <Handle_Standard_Transient.hxx>
-#  else
+#  if DEAL_II_OPENCASCADE_VERSION_GTE(7, 0, 0)
 #    include <Standard_Transient.hxx>
+#  else
+#    include <Handle_Standard_Transient.hxx>
 #  endif
 
 #  include <BRepAdaptor_Curve.hxx>
@@ -328,12 +329,12 @@ namespace OpenCASCADE
 
     StlAPI_Writer writer;
 
-#  if ((OCC_VERSION_MAJOR * 100 + OCC_VERSION_MINOR * 10) >= 690)
+#  if DEAL_II_OPENCASCADE_VERSION_GTE(6, 9, 0)
     // opencascade versions 6.9.0 onwards return an error status
     const auto error = writer.Write(shape_to_be_written, filename.c_str());
 
     // which is a custom type between 6.9.0 and 7.1.0
-#    if ((OCC_VERSION_MAJOR * 100 + OCC_VERSION_MINOR * 10) < 720)
+#    if !DEAL_II_OPENCASCADE_VERSION_GTE(7, 2, 0)
     AssertThrow(error == StlAPI_StatusOK,
                 ExcMessage("Error writing STL from shape."));
 #    else

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.