Skip to content

Commit

Permalink
Merge branch 'main' into feature-cmake_CI_with_submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
sandro-elsweijer authored Sep 23, 2024
2 parents c16261f + e92f3bc commit 22f4751
Show file tree
Hide file tree
Showing 13 changed files with 201 additions and 88 deletions.
30 changes: 15 additions & 15 deletions cmake/FindOpenCASCADE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,47 +34,47 @@ IF( NOT OpenCASCADE_FOUND )
ENDIF( CMAKE_SIZEOF_VOID_P EQUAL 4 )

IF(UNIX)
set( _incsearchpath /usr/include/opencascade /usr/include/ /opt/occ/inc ${CASROOT}/inc ${CASROOT}/include/)
set( _libsearchpath /usr/lib64 /usr/lib /opt/occ/lib ${CASROOT}/lib64 ${CASROOT}/lib )
set( _incsearchpath /usr/include/opencascade;/usr/include/;/opt/occ/inc;${CASROOT}/inc;${CASROOT}/include/ )
set( _libsearchpath /usr/lib64;/usr/lib;/opt/occ/lib;${CASROOT}/lib64;${CASROOT}/lib )
ELSE(UNIX)
IF (WIN32)
set( _incsearchpath ${CASROOT}\\inc ${CASROOT}\\include)
set( _incsearchpath ${CASROOT}\\inc;${CASROOT}\\include)
set( _testdllname TKernel.dll )
set( _libsearchpath ${CASROOT}\\win32\\lib ${CASROOT}\\win${BITS}\\lib ${CASROOT}\\win${BITS}\\vc9\\lib ${CASROOT}\\win${BITS}\\vc10\\lib ${CASROOT}\\win${BITS}\\vc14\\lib)
set( _dllsearchpath ${CASROOT}\\win32\\bin ${CASROOT}\\win${BITS}\\bin ${CASROOT}\\win${BITS}\\vc9\\bin ${CASROOT}\\win${BITS}\\vc10\\bin ${CASROOT}\\win${BITS}\\vc14\\bin)
set( _libsearchpath ${CASROOT}\\win32\\lib;${CASROOT}\\win${BITS}\\lib;${CASROOT}\\win${BITS}\\vc9\\lib;${CASROOT}\\win${BITS}\\vc10\\lib;${CASROOT}\\win${BITS}\\vc14\\lib)
set( _dllsearchpath ${CASROOT}\\win32\\bin;${CASROOT}\\win${BITS}\\bin;${CASROOT}\\win${BITS}\\vc9\\bin;${CASROOT}\\win${BITS}\\vc10\\bin;${CASROOT}\\win${BITS}\\vc14\\bin)
ELSE(WIN32)
message( FATAL_ERROR "Unknown system! Exiting." )
ENDIF (WIN32)
ENDIF (UNIX)

#find the include dir by looking for Standard_Real.hxx
FIND_PATH( OpenCASCADE_INCLUDE_DIR Standard_Real.hxx PATH_SUFFIXES oce PATHS ${_incsearchpath} DOC "Path to OCC includes" )
IF( OpenCASCADE_INCLUDE_DIR STREQUAL Standard_Real.hxx-NOTFOUND )
FIND_PATH( OpenCASCADE_INCLUDE_DIR Standard_Real.hxx PATH_SUFFIXES oce PATHS ${_incsearchpath} DOC "Path to OCC includes" )
IF( OpenCASCADE_INCLUDE_DIR MATCHES "NOTFOUND" )
SET( OpenCASCADE_FOUND FALSE CACHE BOOL FORCE )
MESSAGE( FATAL_ERROR "Cannot find OCC include dir. Install opencascade or set CASROOT or create a symlink /opt/occ/inc pointing to the correct directory." )
ENDIF( OpenCASCADE_INCLUDE_DIR STREQUAL Standard_Real.hxx-NOTFOUND )
MESSAGE( FATAL_ERROR "Cannot find OCC include dir. Install opencascade or add the include directory to INCLUDE or set CASROOT or create a symlink /opt/occ/inc pointing to the correct directory." )
ENDIF( OpenCASCADE_INCLUDE_DIR MATCHES "NOTFOUND" )

# Find one lib and save its directory to OpenCASCADE_LINK_DIRECTORY. Because
# OCC has so many libs, there is increased risk of a name collision.
# Requiring that all libs be in the same directory reduces the risk.
SET( OpenCASCADE_LINK_DIRECTORY "OpenCASCADE_LINK_DIRECTORY-NOTFOUND" CACHE PATH "Path to OCC libs" )
FIND_LIBRARY(TKernel_OCCLIB NAMES TKernel PATHS ${_libsearchpath} ${OpenCASCADE_LINK_DIRECTORY})
MARK_AS_ADVANCED( TKernel_OCCLIB )
IF(TKernel_OCCLIB STREQUAL TKernel_OCCLIB-NOTFOUND)
IF(TKernel_OCCLIB MATCHES "NOTFOUND")
SET( OpenCASCADE_FOUND FALSE CACHE BOOL FORCE )
MESSAGE( FATAL_ERROR "Cannot find OCC lib dir. Install opencascade or set CASROOT or create a symlink /opt/occ/lib pointing to the dir where the OCC libs are." )
ELSE(TKernel_OCCLIB STREQUAL TKernel_OCCLIB-NOTFOUND)
MESSAGE( FATAL_ERROR "Cannot find OCC lib dir. Install opencascade or add the lib directory to LIB or set CASROOT or create a symlink /opt/occ/lib pointing to the dir where the OCC libs are." )
ELSE(TKernel_OCCLIB MATCHES "NOTFOUND")
GET_FILENAME_COMPONENT(TMPDIR ${TKernel_OCCLIB} PATH)
SET( OpenCASCADE_LINK_DIRECTORY ${TMPDIR} CACHE PATH "Path to OCC libs" FORCE)
ENDIF(TKernel_OCCLIB STREQUAL TKernel_OCCLIB-NOTFOUND)
ENDIF(TKernel_OCCLIB MATCHES "NOTFOUND")

# check dll path
if(WIN32)
FIND_PATH( OpenCASCADE_DLL_DIRECTORY ${_testdllname} PATH ${_dllsearchpath} DOC "Path to OCC dlls" NO_SYSTEM_ENVIRONMENT_PATH)
IF( OpenCASCADE_DLL_DIRECTORY STREQUAL OpenCASCADE_DLL_DIRECTORY-NOTFOUND )
IF( OpenCASCADE_DLL_DIRECTORY MATCHES "NOTFOUND" )
SET( OpenCASCADE_FOUND FALSE CACHE BOOL FORCE )
MESSAGE( FATAL_ERROR "Cannot find OCC DLL dir. Install opencascade or set CASROOT to the correct directory." )
ENDIF( OpenCASCADE_DLL_DIRECTORY STREQUAL OpenCASCADE_DLL_DIRECTORY-NOTFOUND )
ENDIF( OpenCASCADE_DLL_DIRECTORY MATCHES "NOTFOUND" )
endif(WIN32)

# everything was found
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ target_sources( T8 PRIVATE
t8_cmesh/t8_cmesh_vtk_reader.cxx
t8_cmesh/t8_cmesh_save.cxx
t8_cmesh/t8_cmesh_netcdf.c
t8_cmesh/t8_cmesh_trees.c
t8_cmesh/t8_cmesh_trees.cxx
t8_cmesh/t8_cmesh_commit.cxx
t8_cmesh/t8_cmesh_partition.cxx
t8_cmesh/t8_cmesh_copy.c
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ libt8_compiled_sources = \
src/t8_cmesh/t8_cmesh_vtk_reader.cxx \
src/t8_cmesh/t8_cmesh_save.cxx \
src/t8_cmesh/t8_cmesh_netcdf.c \
src/t8_cmesh/t8_cmesh_trees.c src/t8_cmesh/t8_cmesh_commit.cxx \
src/t8_cmesh/t8_cmesh_trees.cxx src/t8_cmesh/t8_cmesh_commit.cxx \
src/t8_cmesh/t8_cmesh_partition.cxx\
src/t8_cmesh/t8_cmesh_copy.c src/t8_data/t8_shmem.c \
src/t8_cmesh/t8_cmesh_geometry.cxx \
Expand Down
18 changes: 11 additions & 7 deletions src/t8_cmesh/t8_cmesh_commit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ t8_cmesh_set_shmem_type (sc_MPI_Comm comm)
}

static void
t8_cmesh_add_attributes (const t8_cmesh_t cmesh, sc_hash_t *ghost_ids, size_t *attribute_data_offset)
t8_cmesh_add_attributes (const t8_cmesh_t cmesh, sc_hash_t *ghost_ids)
{
t8_stash_attribute_struct_t *attribute;
const t8_stash_t stash = cmesh->stash;
Expand All @@ -94,6 +94,7 @@ t8_cmesh_add_attributes (const t8_cmesh_t cmesh, sc_hash_t *ghost_ids, size_t *a

temp_facejoin = T8_ALLOC_ZERO (t8_ghost_facejoin_t, 1);

t8_locidx_t ghosts_inserted = 0;
ltree = -1;
for (si = 0, sj = 0; si < stash->attributes.elem_count; si++, sj++) {
attribute = (t8_stash_attribute_struct_t *) sc_array_index (&stash->attributes, si);
Expand All @@ -112,9 +113,13 @@ t8_cmesh_add_attributes (const t8_cmesh_t cmesh, sc_hash_t *ghost_ids, size_t *a
T8_ASSERT (ghost_ids != NULL);
temp_facejoin->ghost_id = attribute->id;
if (sc_hash_lookup (ghost_ids, temp_facejoin, (void ***) &facejoin_pp)) {
T8_ASSERT ((t8_locidx_t) sj == (t8_locidx_t) (*facejoin_pp)->attr_id);
if (sj == 0) {
ghosts_inserted++;
}
/* attribute is on a ghost tree */
t8_cmesh_trees_add_ghost_attribute (cmesh->trees, 0, attribute, (*facejoin_pp)->local_id,
(*facejoin_pp)->attr_id, attribute_data_offset);
t8_cmesh_trees_add_ghost_attribute (cmesh->trees, attribute, (*facejoin_pp)->local_id, ghosts_inserted,
(*facejoin_pp)->attr_id);
(*facejoin_pp)->attr_id++;
}
}
Expand Down Expand Up @@ -167,7 +172,7 @@ t8_cmesh_commit_replicated_new (t8_cmesh_t cmesh)
t8_stash_attribute_sort (cmesh->stash);
cmesh->num_trees = cmesh->num_local_trees = num_trees;
cmesh->first_tree = 0;
t8_cmesh_add_attributes (cmesh, NULL, NULL);
t8_cmesh_add_attributes (cmesh, NULL);

/* Set all face connections */
t8_cmesh_trees_set_all_boundary (cmesh, cmesh->trees);
Expand Down Expand Up @@ -198,7 +203,6 @@ t8_cmesh_commit_partitioned_new (t8_cmesh_t cmesh, sc_MPI_Comm comm)
t8_cghost_t ghost1;
int F;
size_t si;
size_t attribute_data_offset;

#if T8_ENABLE_DEBUG
sc_flopinfo_t fi, snapshot;
Expand Down Expand Up @@ -375,7 +379,7 @@ t8_cmesh_commit_partitioned_new (t8_cmesh_t cmesh, sc_MPI_Comm comm)
ghost1->att_offset += attribute->attr_size;
}
}
attribute_data_offset = t8_cmesh_trees_finish_part (cmesh->trees, 0);
t8_cmesh_trees_finish_part (cmesh->trees, 0);
t8_cmesh_trees_set_all_boundary (cmesh, cmesh->trees);

/* Go through all face_neighbour entries and parse every
Expand Down Expand Up @@ -473,7 +477,7 @@ t8_cmesh_commit_partitioned_new (t8_cmesh_t cmesh, sc_MPI_Comm comm)
* counting the attributes per tree. */

t8_stash_attribute_sort (cmesh->stash);
t8_cmesh_add_attributes (cmesh, ghost_ids, &attribute_data_offset);
t8_cmesh_add_attributes (cmesh, ghost_ids);

/* compute global number of trees. id1 serves as buffer since
* global number and local number have different datatypes */
Expand Down
2 changes: 1 addition & 1 deletion src/t8_cmesh/t8_cmesh_examples.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ t8_cmesh_new_pyramid (sc_MPI_Comm comm)
/* Use linear geometry */
t8_cmesh_register_geometry<t8_geometry_linear> (cmesh, 3);
t8_cmesh_set_tree_class (cmesh, 0, T8_ECLASS_PYRAMID);
t8_cmesh_set_tree_vertices (cmesh, 0, vertices, 15);
t8_cmesh_set_tree_vertices (cmesh, 0, vertices, 5);
t8_cmesh_commit (cmesh, comm);
return cmesh;
}
Expand Down
Loading

0 comments on commit 22f4751

Please sign in to comment.