ENDIF(MEDCOUPLING_ENABLE_RENUMBER)
IF(MEDCOUPLING_ENABLE_SHAPERECOGN)
- FIND_PACKAGE(BLAS REQUIRED)
+IF(UNIX)
+ SET(CBLAS_ROOT_DIR $ENV{CBLAS_ROOT_DIR} CACHE PATH "Path to the LAPACK/CBLAS.")
+ IF(CBLAS_ROOT_DIR)
+ LIST(APPEND CMAKE_PREFIX_PATH "${CBLAS_ROOT_DIR}")
+ FIND_PACKAGE(CBLAS REQUIRED)
+ ELSE(CBLAS_ROOT_DIR)
+ FIND_PACKAGE(BLAS REQUIRED)
+ ENDIF(CBLAS_ROOT_DIR)
+ SET(LAPACK_ROOT_DIR $ENV{LAPACK_ROOT_DIR} CACHE PATH "Path to the LAPACKE")
+ IF(LAPACK_ROOT_DIR)
+ SET(LAPACK_ROOT_DIR $ENV{LAPACK_ROOT_DIR} CACHE PATH "Path to the LAPACK.")
+ LIST(APPEND CMAKE_PREFIX_PATH "${LAPACK_ROOT_DIR}")
+ ENDIF(LAPACK_ROOT_DIR)
FIND_PACKAGE(LAPACK REQUIRED)
FIND_LIBRARY(LAPACKE_LIB NAMES lapacke REQUIRED)
SET(LAPACK_LIBRARIES ${LAPACKE_LIB} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
MESSAGE(FATAL_ERROR "Error in Lapacke detection ! lapacke not found !")
ENDIF(LAPACK_FOUND)
SALOME_LOG_OPTIONAL_PACKAGE(Lapack MEDCOUPLING_ENABLE_SHAPERECOGN)
+ELSEIF (MSVC)
+ SET(OPENBLAS_ROOT_DIR $ENV{OPENBLAS_ROOT_DIR} CACHE PATH "Path to the OpenBLAS.")
+ IF(OPENBLAS_ROOT_DIR)
+ LIST(APPEND CMAKE_PREFIX_PATH "${OPENBLAS_ROOT_DIR}")
+ FIND_PACKAGE(OpenBLAS REQUIRED)
+ ELSE(OPENBLAS_ROOT_DIR)
+ MESSAGE(FATAL "Could not find OpenBLAS")
+ ENDIF(OPENBLAS_ROOT_DIR)
+ SET(LAPACK_ROOT_DIR $ENV{LAPACK_ROOT_DIR} CACHE PATH "Path to the LAPACKE")
+ IF(LAPACK_ROOT_DIR)
+ SET(LAPACK_ROOT_DIR $ENV{LAPACK_ROOT_DIR} CACHE PATH "Path to the LAPACK.")
+ LIST(APPEND CMAKE_PREFIX_PATH "${LAPACK_ROOT_DIR}")
+ ENDIF(LAPACK_ROOT_DIR)
+ FIND_PACKAGE(LAPACK REQUIRED)
+ FIND_LIBRARY(LAPACKE_LIB NAMES openblas REQUIRED)
+ SET(LAPACK_LIBRARIES ${LAPACKE_LIB} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
+ FIND_PATH(LAPACKE_INCLUDE_DIRS NAMES lapacke.h HINTS ${LAPACK_LIBRARIES})
+ IF(LAPACK_FOUND)
+ MESSAGE(STATUS "Lapacke libraries: ${LAPACK_LIBRARIES}")
+ MESSAGE(STATUS "Lapacke include dirs: ${LAPACKE_INCLUDE_DIRS}")
+ ELSE()
+ MESSAGE(FATAL_ERROR "Error in Lapacke detection ! lapacke not found !")
+ ENDIF(LAPACK_FOUND)
+ SALOME_LOG_OPTIONAL_PACKAGE(Lapack MEDCOUPLING_ENABLE_SHAPERECOGN)
+
+ElSE()
+ MESSAGE(FATAL "Not implemented")
+ENDIF()
ENDIF(MEDCOUPLING_ENABLE_SHAPERECOGN)
IF(MEDCOUPLING_ENABLE_PYTHON)
//
#pragma once
-
+#include "ShapeRecognDefines.hxx"
#include "PrimitiveType.hxx"
#include "Nodes.hxx"
std::vector<mcIdType> nodeIds;
};
- class Areas
+ class SHAPE_RECOGNITION_EXPORT Areas
{
public:
Areas(const Nodes *nodes);
#include "Nodes.hxx"
#include "Areas.hxx"
-
+#include "ShapeRecognDefines.hxx"
namespace MEDCoupling
{
- class AreasBuilder
+ class SHAPE_RECOGNITION_EXPORT AreasBuilder
{
public:
AreasBuilder(const Nodes *nodes);
#include "MCIdType.hxx"
#include <algorithm>
-#include <lapacke.h>
-#include <cblas.h>
+#if defined(_MSC_VER)
+ #include <complex.h>
+ #define LAPACK_COMPLEX_CUSTOM
+ #define lapack_complex_float _Fcomplex
+ #define lapack_complex_double _Dcomplex
+ #include <openblas/lapacke.h>
+ #include <openblas/cblas.h>
+ //#include <lapacke.h>
+ //#include <cblas.h>
+#else
+ #include <lapacke.h>
+ #include <cblas.h>
+#endif
#include <iostream>
#include <cfloat>
#include <cmath>
#include <vector>
#include <array>
-
+#include "ShapeRecognDefines.hxx"
namespace MEDCoupling
{
- class MathOps
+ class SHAPE_RECOGNITION_EXPORT MathOps
{
public:
static std::vector<double> lstsq(std::vector<double> &a, const std::vector<double> &b);
#include <vector>
#include "MEDCouplingUMesh.hxx"
#include "PrimitiveType.hxx"
+#include <array>
+#include "ShapeRecognDefines.hxx"
namespace MEDCoupling
{
- class Nodes
+ class SHAPE_RECOGNITION_EXPORT Nodes
{
public:
friend class NodesBuilder;
Nodes(const MEDCouplingUMesh *mesh,
const DataArrayInt64 *neighbors,
const DataArrayInt64 *neighborsIdx);
- ~Nodes() = default;
mcIdType getNbNodes() const;
const std::vector<double> &getK1() const;
#include <array>
#include "MEDCouplingUMesh.hxx"
#include "PrimitiveType.hxx"
-
+#include "ShapeRecognDefines.hxx"
namespace MEDCoupling
{
class Nodes;
- class NodesBuilder
+ class SHAPE_RECOGNITION_EXPORT NodesBuilder
{
public:
NodesBuilder(const MEDCouplingUMesh *);
#include <vector>
#include <string>
#include <cstdint>
-
+#include "ShapeRecognDefines.hxx"
namespace MEDCoupling
{
- enum class PrimitiveType : std::uint8_t
+ enum class SHAPE_RECOGNITION_EXPORT PrimitiveType : unsigned char
{
Plane = 0,
Sphere = 1,
Unknown = 5
};
- std::vector<PrimitiveType> AllManagedPrimitives();
+ SHAPE_RECOGNITION_EXPORT std::vector<PrimitiveType> AllManagedPrimitives();
- std::vector<std::string> AllManagedPrimitivesStr();
+ SHAPE_RECOGNITION_EXPORT std::vector<std::string> AllManagedPrimitivesStr();
- std::string ConvertPrimitiveToString(PrimitiveType type);
+ SHAPE_RECOGNITION_EXPORT std::string ConvertPrimitiveToString(PrimitiveType type);
- PrimitiveType ConvertStringToPrimitive(const std::string& type);
+ SHAPE_RECOGNITION_EXPORT PrimitiveType ConvertStringToPrimitive(const std::string& type);
- int ConvertPrimitiveToInt(PrimitiveType type);
+ SHAPE_RECOGNITION_EXPORT int ConvertPrimitiveToInt(PrimitiveType type);
};
--- /dev/null
+// Copyright (C) 2007-2024 CEA, EDF
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef __SHAPE_RECOGNITION_DEFINES_HXX__
+#define __SHAPE_RECOGNITION_DEFINES_HXX__
+
+#ifdef WIN32
+# if defined shaperecogn_EXPORTS || TestShapeRecogn_EXPORTS
+# define SHAPE_RECOGNITION_EXPORT __declspec(dllexport)
+# else
+# define SHAPE_RECOGNITION_EXPORT __declspec(dllimport)
+# endif
+#else
+# define SHAPE_RECOGNITION_EXPORT
+#endif
+
+#endif
#include "MEDCouplingFieldInt32.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingRefCountObject.hxx"
-
+#include "ShapeRecognDefines.hxx"
namespace MEDCoupling
{
- class ShapeRecognMesh : public RefCountObject
+ class SHAPE_RECOGNITION_EXPORT ShapeRecognMesh : public RefCountObject
{
friend class ShapeRecognMeshBuilder;
protected:
ShapeRecognMesh();
- ~ShapeRecognMesh() = default;
private:
MCAuto<MEDCouplingFieldDouble> nodeK1;
#include <memory>
#include <functional>
-
+#include "ShapeRecognDefines.hxx"
namespace MEDCoupling
{
class MEDCouplingFieldInt32;
class ShapeRecognMesh;
- class ShapeRecognMeshBuilder
+ class SHAPE_RECOGNITION_EXPORT ShapeRecognMeshBuilder
{
public:
ShapeRecognMeshBuilder(MCAuto< MEDCouplingUMesh > mesh);
ShapeRecognMeshBuilder(MEDCouplingUMesh *mesh);
- ~ShapeRecognMeshBuilder() = default;
const Nodes *getNodes() const;
const Areas *getAreas() const;
//
%{
+#include <vector>
+#include <string>
#include "ShapeRecognMesh.hxx"
#include "ShapeRecognMeshBuilder.hxx"
+#include "PrimitiveType.hxx"
#include "Areas.hxx"
#include <type_traits>
IF(NOT MEDCOUPLING_MICROMED)
SET(TESTSHAPE_RECOGN0 TestShapeRecogn)
ADD_EXECUTABLE(${TESTSHAPE_RECOGN0} ${TestShapeRecogn_SOURCES})
- TARGET_LINK_LIBRARIES(${TESTSHAPE_RECOGN0} shaperecogn InterpKernelTestUtils medloader ${MEDFILE_C_LIBRARIES} ${HDF5_LIBRARIES} ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS})
+ TARGET_LINK_LIBRARIES(${TESTSHAPE_RECOGN0} shaperecogn InterpKernelTestUtils medloader medcouplingcpp ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS} ${CBLAS_LIBRARIES})
INSTALL(TARGETS ${TESTSHAPE_RECOGN0} DESTINATION ${MEDCOUPLING_INSTALL_BINS})
#include "TestInterpKernelUtils.hxx" // getResourceFile()
#include "ShapeRecognTest.hxx"
+#include <vector>
+#include <array>
+#include <string>
using namespace MEDCoupling;
void ConeTest::testFirstArea()
{
// primitive type
- CPPUNIT_ASSERT_EQUAL(PrimitiveType::Plane, areas->getPrimitiveType(0));
+ CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Plane, (int)areas->getPrimitiveType(0));
// node ids
std::vector<mcIdType> nodeIdsRef{
549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559,
void ConeTest::testSecondArea()
{
// primitive type
- CPPUNIT_ASSERT_EQUAL(PrimitiveType::Plane, areas->getPrimitiveType(0));
+ CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Plane, (int)areas->getPrimitiveType(0));
// node ids
std::vector<mcIdType> nodeIdsRef = {
572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583,
void ConeTest::testThirdArea()
{
// primitive type
- CPPUNIT_ASSERT_EQUAL(PrimitiveType::Cone, areas->getPrimitiveType(2));
+ CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Cone, (int)areas->getPrimitiveType(2));
// node ids
std::vector<mcIdType> nodeIdsRef{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
void CylinderTest::testFirstArea()
{
// primitive type
- CPPUNIT_ASSERT_EQUAL(PrimitiveType::Cylinder, areas->getPrimitiveType(0));
+ CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Cylinder, (int) areas->getPrimitiveType(0));
// node ids
std::vector<mcIdType> nodeIdsRef{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
void CylinderTest::testSecondArea()
{
// primitive type
- CPPUNIT_ASSERT_EQUAL(PrimitiveType::Plane, areas->getPrimitiveType(1));
+ CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Plane, (int)areas->getPrimitiveType(1));
// node ids
std::vector<mcIdType> nodeIdsRef{
370, 371, 372, 373, 374, 375, 376, 377, 378, 379,
void CylinderTest::testThirdArea()
{
// primitive type
- CPPUNIT_ASSERT_EQUAL(PrimitiveType::Plane, areas->getPrimitiveType(2));
+ CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Plane, (int)areas->getPrimitiveType(2));
// node ids
std::vector<mcIdType> nodeIdsRef{
443, 444, 445, 446, 447, 448, 449, 450, 451, 452,
#include "MathOpsTest.hxx"
#include "MathOps.hxx"
-
+#include <cblas.h>
using namespace MEDCoupling;
void MathOpsTest::testLstsq()
CPPUNIT_TEST_SUITE_END();
public:
- static void testLstsq();
- static void testLstsq2();
- static void testLstsqBig();
- static void testComputeCov();
- static void testComputePCAFirstAxis();
- static void testComputeAngles();
- static void testComputeBaseFromNormal();
+ void testLstsq();
+ void testLstsq2();
+ void testLstsqBig();
+ void testComputeCov();
+ void testComputePCAFirstAxis();
+ void testComputeAngles();
+ void testComputeBaseFromNormal();
};
}
CPPUNIT_ASSERT_EQUAL(1, (int)areas->getNumberOfAreas());
// 8 double nodes so 147 - 6 nodes
CPPUNIT_ASSERT_EQUAL(141, (int)areas->getNumberOfNodes(0));
- CPPUNIT_ASSERT_EQUAL(PrimitiveType::Sphere, areas->getPrimitiveType(0));
+ CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Sphere, (int)areas->getPrimitiveType(0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, areas->getRadius(0), 1E-2);
std::array<double, 3> centerRef = {5.3, -6.7, -9.02};
std::array<double, 3> center = areas->getCenter(0);
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+#include "CppUnitTest.hxx"
#include "MathOpsTest.hxx"
#include "PlaneTest.hxx"
#include "CylinderTest.hxx"
{
CPPUNIT_ASSERT_EQUAL(275, (int)srMesh->getNodes()->getNbNodes());
CPPUNIT_ASSERT_EQUAL(1, (int)areas->getNumberOfAreas());
- CPPUNIT_ASSERT_EQUAL(PrimitiveType::Torus, areas->getPrimitiveType(0));
+ CPPUNIT_ASSERT_EQUAL((int)PrimitiveType::Torus, (int)areas->getPrimitiveType(0));
// Some nodes are unknown
CPPUNIT_ASSERT_EQUAL(272, (int)areas->getNumberOfNodes(0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.843297, areas->getMinorRadius(0), 1E-2);