Commit e9c2c94c authored by Janek Kozicki's avatar Janek Kozicki Committed by yade@dig

Extract duplicate CGAL 'using … = ' directives into single file lib/base/AliasCGAL.hpp

parent f061a2ee
#pragma once
#include<lib/base/openmp-accu.hpp>
#include<lib/serialization/Serializable.hpp>
#include<lib/base/Namespaces.hpp>
#include<lib/base/AliasNamespaces.hpp>
namespace yade { // Cannot have #include directive inside.
......
......@@ -17,7 +17,7 @@
#include <core/BodyContainer.hpp>
#include <core/InteractionContainer.hpp>
#include <core/TimeStepper.hpp>
#include <lib/base/Namespaces.hpp>
#include <lib/base/AliasNamespaces.hpp>
#include <pwd.h>
#include <unistd.h>
......
......@@ -2,7 +2,7 @@
#include"OpenGLManager.hpp"
#include<pkg/common/OpenGLRenderer.hpp>
#include<lib/pyutil/doc_opts.hpp>
#include<lib/base/Namespaces.hpp>
#include<lib/base/AliasNamespaces.hpp>
#include<QApplication>
#include<QCloseEvent>
......
......@@ -2,7 +2,7 @@
#include"OpenGLManager.hpp"
#include<pkg/common/OpenGLRenderer.hpp>
#include<lib/pyutil/doc_opts.hpp>
#include<lib/base/Namespaces.hpp>
#include<lib/base/AliasNamespaces.hpp>
#include<QApplication>
#include<QCloseEvent>
......
/*************************************************************************
* 2019 Janek Kozicki *
* *
* This program is free software; it is licensed under the terms of the *
* GNU General Public License v2 or later. See file LICENSE for details. *
*************************************************************************/
#pragma once
// This file is to collect all CGAL aliases inside yade sub-namespace
#ifdef YADE_CGAL
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_triangle_primitive.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Polyhedron_items_with_id_3.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Tetrahedron_3.h>
#include <CGAL/Triangulation_data_structure_3.h>
#include <CGAL/convex_hull_3.h>
#include <CGAL/linear_least_squares_fitting_3.h>
#include <CGAL/squared_distance_3.h>
namespace yade {
// CGAL definitions - does not work with another kernel!! Why??? / Answer: because to use exact kernal yade must link with mpfr / Janek.
// These are taken from files pkg/dem/Polyhedra.hpp and /pkg/dem/Gl1_PotentialBlock.hpp
// let's call this CGP for CGal Polyhedrons namespace. It uses inexact kernel. Later when mpfr support is added we can have similar
// aliases in other namespace for exact kernel. Or maybe later rename namespace into struct, so that this can be used as template argument.
// We will see how this will need to evelove.
// namespace CGP {
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
using Polyhedron = CGAL::Polyhedron_3<K>;
using Mesh = CGAL::Surface_mesh<K::Point_3>;
using Triangulation = CGAL::Delaunay_triangulation_3<K>;
using CGALpoint = K::Point_3;
using CGALtriangle = K::Triangle_3;
using CGALvector = K::Vector_3;
using Transformation = CGAL::Aff_transformation_3<K>;
using Segment = K::Segment_3;
using Triangle = CGAL::Triangle_3<K>;
using Plane = CGAL::Plane_3<K>;
using Line = CGAL::Line_3<K>;
using CGAL_ORIGIN = CGAL::Origin;
using CGAL_AABB_tree = CGAL::AABB_tree<CGAL::AABB_traits<K,CGAL::AABB_triangle_primitive<K,std::vector<Triangle>::iterator>>>;
// }
// It would be perhaps useful to collect here similar stuff frmo other files.
}
#endif
......@@ -12,7 +12,7 @@
#include <boost/type_traits/integral_constant.hpp>
#include <lib/base/Namespaces.hpp>
#include <lib/base/AliasNamespaces.hpp>
#include <lib/base/Math.hpp>
#include <lib/factory/Factorable.hpp>
#include <lib/pyutil/raw_constructor.hpp>
......
......@@ -41,6 +41,7 @@ inline void revertEdge (unsigned &i,unsigned &j){
else {j=facetVertices[i][1]; i=facetVertices[i][0];}
}
// FIXME - consider moving these into lib/base/AliasCGAL.hpp
namespace CGT {
//Robust kernel
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
......
......@@ -71,22 +71,6 @@
#include <pkg/common/Dispatching.hpp>
#include <pkg/common/ElastMat.hpp>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_data_structure_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Polyhedron_items_with_id_3.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/convex_hull_3.h>
#include <CGAL/Tetrahedron_3.h>
#include <CGAL/linear_least_squares_fitting_3.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_triangle_primitive.h>
#include <CGAL/squared_distance_3.h>
#ifdef YADE_OPENGL
#include<pkg/common/GLDrawFunctors.hpp>
#include<lib/opengl/OpenGLWrapper.hpp>
......@@ -95,35 +79,14 @@
#include<pkg/dem/Shop.hpp>
#endif
#include <lib/base/AliasCGAL.hpp>
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
namespace yade { // Cannot have #include directive inside.
/* NEW SCRIPT USING FACETS*/
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)
//CGAL definitions - does not work with another kernel!! Why???
// FIXME - this should be collected in single place. It's in three different places already!
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
using Polyhedron = CGAL::Polyhedron_3<K>;
using Mesh = CGAL::Surface_mesh<K::Point_3>;
using Triangulation = CGAL::Delaunay_triangulation_3<K>;
using CGALpoint = K::Point_3;
using CGALtriangle = K::Triangle_3;
using CGALvector = K::Vector_3;
using Transformation = CGAL::Aff_transformation_3<K>;
using Segment = K::Segment_3;
using Triangle = CGAL::Triangle_3<K>;
using Plane = CGAL::Plane_3<K>;
using Line = CGAL::Line_3<K>;
using CGAL_ORIGIN = CGAL::Origin;
using CGAL_AABB_tree = CGAL::AABB_tree<CGAL::AABB_traits<K,CGAL::AABB_triangle_primitive<K,std::vector<Triangle>::iterator>>>;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
......
......@@ -2,7 +2,7 @@
#pragma once
#include <lib/serialization/Serializable.hpp>
#include <boost/unordered_map.hpp>
#include <lib/base/Namespaces.hpp>
#include <lib/base/AliasNamespaces.hpp>
namespace yade { // Cannot have #include directive inside.
......
......@@ -4,7 +4,7 @@
#include<core/IPhys.hpp>
#include<pkg/dem/ScGeom.hpp>
#include<pkg/common/Dispatching.hpp>
#include<lib/base/Namespaces.hpp>
#include<lib/base/AliasNamespaces.hpp>
namespace yade { // Cannot have #include directive inside.
......
......@@ -54,7 +54,7 @@ There are other classes, which are not strictly necessary:
#include<pkg/dem/DemXDofGeom.hpp>
#include<pkg/dem/ScGeom.hpp>
#include<pkg/dem/FrictPhys.hpp>
#include<lib/base/Namespaces.hpp>
#include<lib/base/AliasNamespaces.hpp>
#ifdef YADE_OPENGL
#include<pkg/common/GLDrawFunctors.hpp>
......
......@@ -110,6 +110,8 @@ getIncidentVtxWeights(const Dt& dt,
namespace yade { // Cannot have #include directive inside.
// FIXME - consider moving these (maybe with Triangulation_vertex_base_with_id_3 ?) into lib/base/AliasCGAL.hpp, preferably put them inside another namespace
//namespace CGsomeName{
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Delaunay_triangulation_3<K>::Geom_traits Traits;
typedef CGAL::Triangulation_vertex_base_with_id_3<Traits> Vb;
......@@ -117,6 +119,7 @@ typedef CGAL::Triangulation_cell_base_3<Traits> Cb;
typedef CGAL::Triangulation_data_structure_3<Vb, Cb> Tds;
typedef CGAL::Delaunay_triangulation_3<Traits,Tds> DT;
typedef std::vector< std::pair< DT::Vertex_handle, K::FT> > Vertex_weight_vector;
//}
template <class Dt, class DataOwner>
typename DataOwner::Data interpolate1 (const Dt& dt, const typename Dt::Geom_traits::Point_3& Q, DataOwner& owner, const std::vector<typename DataOwner::Data>& rawData, bool reset)
......
......@@ -12,7 +12,7 @@
#include<pkg/dem/FrictPhys.hpp>
#include<pkg/dem/ElasticContactLaw.hpp>
#include<pkg/dem/Lubrication.hpp>
#include<lib/base/Namespaces.hpp>
#include<lib/base/AliasNamespaces.hpp>
namespace yade { // Cannot have #include directive inside.
......
......@@ -13,7 +13,7 @@
#include<pkg/dem/ElasticContactLaw.hpp>
#include<pkg/dem/ViscoelasticPM.hpp>
#include<pkg/dem/PDFEngine.hpp>
#include<lib/base/Namespaces.hpp>
#include<lib/base/AliasNamespaces.hpp>
namespace yade { // Cannot have #include directive inside.
......
......@@ -10,7 +10,7 @@
#include<pkg/dem/DemXDofGeom.hpp>
#include<pkg/dem/ScGeom.hpp>
#include<pkg/dem/FrictPhys.hpp>
#include<lib/base/Namespaces.hpp>
#include<lib/base/AliasNamespaces.hpp>
namespace yade { // Cannot have #include directive inside.
......
......@@ -22,19 +22,6 @@
#include <pkg/common/Dispatching.hpp>
#include <pkg/common/ElastMat.hpp>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_data_structure_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Polyhedron_items_with_id_3.h>
#include <CGAL/convex_hull_3.h>
#include <CGAL/Tetrahedron_3.h>
#include <CGAL/linear_least_squares_fitting_3.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_triangle_primitive.h>
#include <CGAL/squared_distance_3.h>
#ifdef YADE_OPENGL
#include<pkg/common/GLDrawFunctors.hpp>
#include<lib/opengl/OpenGLWrapper.hpp>
......@@ -43,29 +30,10 @@
#include<pkg/dem/Shop.hpp>
#endif
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)
#include <lib/base/AliasCGAL.hpp>
namespace yade { // Cannot have #include directive inside.
// FIXME - these 'using' directives are polluting namespace, better to put them inside another namespace
//namespace CGpoly {
//CGAL definitions - does not work with another kernel!! Why???
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
using Polyhedron = CGAL::Polyhedron_3<K>;
using Triangulation = CGAL::Delaunay_triangulation_3<K>;
using CGALpoint = K::Point_3;
using CGALtriangle = K::Triangle_3;
using CGALvector = K::Vector_3;
using Transformation = CGAL::Aff_transformation_3<K>;
using Segment = K::Segment_3;
using Triangle = CGAL::Triangle_3<K>;
using Plane = CGAL::Plane_3<K>;
using Line = CGAL::Line_3<K>;
using CGAL_ORIGIN = CGAL::Origin;
using CGAL_AABB_tree = CGAL::AABB_tree<CGAL::AABB_traits<K,CGAL::AABB_triangle_primitive<K,std::vector<Triangle>::iterator>>>;
//}
//**********************************************************************************
class Polyhedra: public Shape{
public:
......
......@@ -9,6 +9,9 @@
#include "Polyhedra.hpp"
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)
namespace yade { // Cannot have #include directive inside.
CREATE_CPP_LOCAL_LOGGER("Polyhedra_support.cpp");
......
......@@ -9,7 +9,7 @@
#include "core/Body.hpp"
#include<boost/function.hpp>
#include<lib/base/Namespaces.hpp>
#include<lib/base/AliasNamespaces.hpp>
namespace yade { // Cannot have #include directive inside.
......
......@@ -12,7 +12,7 @@
#include <boost/random/variate_generator.hpp>
#include<core/Timing.hpp>
#include<lib/base/Namespaces.hpp>
#include<lib/base/AliasNamespaces.hpp>
namespace yade { // Cannot have #include directive inside.
......
......@@ -30,7 +30,7 @@
#include<pkg/common/Sphere.hpp>
#include<pkg/dem/CohesiveFrictionalContactLaw.hpp>
#include<boost/filesystem.hpp>
#include<lib/base/Namespaces.hpp>
#include<lib/base/AliasNamespaces.hpp>
namespace yade { // Cannot have #include directive inside.
......
......@@ -12,7 +12,7 @@
#include<core/Omega.hpp>
#include<lib/pyutil/doc_opts.hpp>
#include<lib/base/Logging.hpp>
#include<lib/base/Namespaces.hpp>
#include<lib/base/AliasNamespaces.hpp>
#include<string>
namespace yade { // Cannot have #include directive inside.
......
......@@ -10,7 +10,7 @@
#include <pkg/common/Sphere.hpp>
#include <pkg/common/ElastMat.hpp>
#include <lib/pyutil/doc_opts.hpp>
#include <lib/base/Namespaces.hpp>
#include <lib/base/AliasNamespaces.hpp>
#include <cmath>
#include <numpy/ndarraytypes.h>
......
......@@ -12,7 +12,7 @@
#include<lib/computational-geometry/Hull2d.hpp>
#include<lib/pyutil/doc_opts.hpp>
#include<pkg/dem/ViscoelasticPM.hpp>
#include<lib/base/Namespaces.hpp>
#include<lib/base/AliasNamespaces.hpp>
#ifdef YADE_MPI
#include <mpi.h>
#endif
......
......@@ -2,7 +2,7 @@
#include<lib/base/Logging.hpp>
#include<lib/base/Math.hpp>
#include<lib/pyutil/doc_opts.hpp>
#include<lib/base/Namespaces.hpp>
#include<lib/base/AliasNamespaces.hpp>
namespace yade { // Cannot have #include directive inside.
......
......@@ -42,7 +42,7 @@
#include <csignal>
#include <pkg/common/KinematicEngines.hpp>
#include <lib/base/Namespaces.hpp>
#include <lib/base/AliasNamespaces.hpp>
namespace yade { // Cannot have #include directive inside.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment