CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (https://www.cfd-online.com/Forums/openfoam-installation/)
-   -   [OpenFOAM.org] CGAL location (https://www.cfd-online.com/Forums/openfoam-installation/190482-cgal-location.html)

macelee July 15, 2017 01:21

CGAL location
 
While compiling OpenFOAM I ran into this error:

Code:

-L/lib64 -L/lib64 -L/lustre/home/user/OpenFOAM/ThirdParty-4.1/platforms/linux64Gcc/boost-system/lib -L/lustre/home/user/OpenFOAM/ThirdParty-4.1/platforms/linux64Gcc/CGAL-4.10/lib -lCGAL -lmpfr -lmeshTools -ledgeMesh -lfileFormats -ltriSurface -ldynamicMesh -lsurfMesh -lsampling -lsnappyHexMesh  -o /lustre/home/user/OpenFOAM/OpenFOAM-4.1/platforms/linux64GccDPInt32Opt/lib/libconformalVoronoiMesh.so
/usr/bin/ld: cannot find -lCGAL

CGAL appears to be compiled properly at an early time, but it was located at:
Code:

.../platforms/linux64Gcc/CGAL-4.10/lib64  # Note lib64 instead of lib
Of course I can fix this problem manually quite easily. But I am working on a script to install OpenFOAM automatically. So where is the best place to fix this problem?

saddy July 15, 2017 02:29

this answer can be easily given by wyldcat.....he is second to none...d best

nishant_hull June 21, 2018 04:57

issue
 
Hi Macelee, Have you found a better way to resolve it?



regards,


Nish




Quote:

Originally Posted by macelee (Post 657154)
While compiling OpenFOAM I ran into this error:

Code:

-L/lib64 -L/lib64 -L/lustre/home/user/OpenFOAM/ThirdParty-4.1/platforms/linux64Gcc/boost-system/lib -L/lustre/home/user/OpenFOAM/ThirdParty-4.1/platforms/linux64Gcc/CGAL-4.10/lib -lCGAL -lmpfr -lmeshTools -ledgeMesh -lfileFormats -ltriSurface -ldynamicMesh -lsurfMesh -lsampling -lsnappyHexMesh  -o /lustre/home/user/OpenFOAM/OpenFOAM-4.1/platforms/linux64GccDPInt32Opt/lib/libconformalVoronoiMesh.so
/usr/bin/ld: cannot find -lCGAL

CGAL appears to be compiled properly at an early time, but it was located at:
Code:

.../platforms/linux64Gcc/CGAL-4.10/lib64  # Note lib64 instead of lib
Of course I can fix this problem manually quite easily. But I am working on a script to install OpenFOAM automatically. So where is the best place to fix this problem?


fertinaz June 27, 2018 21:41

See file:
Code:

OpenFOAM/OpenFOAM-5.0/etc/config.sh/CGAL
There you will find the definition thirdPartyPath which points to the installation directory of the third party packages:
Code:

thirdPartyPath=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH
This path is pointing to linux64Gcc if you're using Gcc compiler.

In the same file you will also see:
Code:

    export CGAL_ARCH_PATH=$thirdPartyPath/$cgal_version
    if [ -d "$CGAL_ARCH_PATH" ]
    then
        _foamAddLib $CGAL_ARCH_PATH/lib
    fi

So if you're using CGAL-4.10, CGAL_ARCH_PATH becomes linux64Gcc/CGAL-4.10. And lib under this path is added to the list of libs inside the if condition.

You can modify here using sed if you want to automate it in a build script. For instance:
Code:

sed 's,_foamAddLib $CGAL_ARCH_PATH\/lib,_foamAddLib $CGAL_ARCH_PATH\/lib64' $WM_PROJECT_DIR/etc/config.sh/CGAL

olesen July 5, 2018 08:09

Quote:

Originally Posted by fertinaz (Post 697498)
You can modify here using sed if you want to automate it in a build script. For instance:
Code:

sed 's,_foamAddLib $CGAL_ARCH_PATH\/lib,_foamAddLib $CGAL_ARCH_PATH\/lib64' $WM_PROJECT_DIR/etc/config.sh/CGAL

The problem when setting libraries is that you have a few ways that could be correct (or wrong). Treat either lib/ or lib64/ or both, or only include what is actually on disk.
Sometime you only want to add a library path if it really exists, sometimes it doesn't exists until the ThirdParty build is through.

For OpenFOAM-v1806, this problem is handled with some additional logic, bundled as a _foamAddLibAuto function.


If you want to auto explore lib/ and lib64/ but only use it if it exists:
Code:

    _foamAddLibAuto $CGAL_ARCH_PATH
If you want to do the same, but provide a fallback value if nothing has been compiled yet:
Code:

    _foamAddLibAuto $CGAL_ARCH_PATH  lib$WM_COMPILER_LIB_ARCH
This particular fallback should generally be OK when used with the ThirdParty makeCGAL, since it now explicitly uses the same thing:
Code:

    -DCGAL_INSTALL_LIB_DIR=lib$WM_COMPILER_LIB_ARCH

Ree.Nine November 18, 2021 18:53

Delaunay triangulation 3D with CGAL
 
I am trying to use CGAL to do some Delaunay triangulation. I used one of the CGAL samples to compute a triangulation which includes a height field attribute.

The problem I have having is that I have no idea how to get the resulting triangulation. I figured out how to get the face_iterator, but I don't know what to do from there. What I'm hoping to get is an index into the point array for each of the 3 points on each triangle.

Im just wanna get smth like: Triang: triangle1 = (1,2,3) triangle2 = (3,4,1) where numbers its a vertices HELP PLEASE!!!

This is my code:

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Random.h>
#include <CGAL/Triangulation_3.h>
#include <CGAL/Delaunay_triangulation_cell_base_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.h>


#include <vector>
#include <cassert>
#include <iostream>
#include <fstream>

using namespace std;

typedef CGAL::Exact_predicates_inexact_constructions_kerne l K;
typedef CGAL::Delaunay_triangulation_3<K, CGAL::Fast_location> Delaunay;
typedef Delaunay::Point Point;
typedef Delaunay::Vertex_handle Vertex_handle;
typedef Delaunay::Cell_handle Cell_handle;
typedef Delaunay::All_cells_iterator Cells_iterator;
typedef Delaunay::Vertex Vertex;

typedef CGAL::Triangulation_vertex_base_with_info_3<unsign ed, K> Vb;
typedef CGAL::Delaunay_triangulation_cell_base_3<K> Cb;
typedef CGAL::Triangulation_data_structure_3<Vb, Cb> Tds;

typedef Delaunay::Finite_vertices_iterator Finite_vertices_iterator;
typedef Delaunay::Finite_edges_iterator Finite_edges_iterator;
typedef Delaunay::Finite_facets_iterator Finite_facets_iterator;
typedef Delaunay::Finite_cells_iterator Finite_cells_iterator;
typedef Delaunay::Simplex Simplex;
typedef Delaunay::Locate_type Locate_type;




int main()
{
// generating points on a grid.
std::vector<Point> P;

for (int z = 0; z < 3; z++)
for (int y = 0; y < 3; y++)
for (int x = 0; x < 3; x++)
P.push_back(Point(x, y, z));

// building their Delaunay triangulation.
Delaunay T(P.begin(), P.end());
//assert(T.number_of_vertices() == 8000);

for (?????????)
{
????????????????????????
}

std::ofstream oFileT("output", std::ios::out);
// writing file output;
oFileT << T;
cout << T.is_valid() << endl;
return 0;
}
```


All times are GMT -4. The time now is 16:46.