Skip to content

Commit

Permalink
Merge branch 'main' into feature-CMake_CI_1
Browse files Browse the repository at this point in the history
  • Loading branch information
sandro-elsweijer authored Aug 13, 2024
2 parents 94f8fda + 99b6d2e commit 8c314e5
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 6 deletions.
File renamed without changes.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ if( T8CODE_ENABLE_NETCDF )
find_package( netCDF REQUIRED )
if(netCDF_FOUND)
message("Found netCDF")
include(cmake/CheckNetCDFPar.cmake)
endif (netCDF_FOUND)
endif( T8CODE_ENABLE_NETCDF )


# Override default for this libsc option
set( BUILD_SHARED_LIBS ON CACHE BOOL "Build libsc as a shared library" )

Expand Down
17 changes: 17 additions & 0 deletions cmake/CheckNetCDFPar.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
include( CheckCSourceCompiles )
function( check_netcdf_par )
set( CMAKE_REQUIRED_LIBRARIES netCDF::netcdf )

check_c_source_compiles(
"
#include <netcdf.h>
#include <netcdf_par.h>
int main() {
return 0;
}
"
NETCDF_HAVE_NETCDF_PAR)
endfunction()

check_netcdf_par()
6 changes: 3 additions & 3 deletions cmake/FindOpenCASCADE.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# taken and adapted from the heekscad project: https://github.com/Heeks

# - Try to find OpenCASCADE libraries
### Does not test what version has been found,though
### that could be done by parsing Standard_Version.hxx
# HeeksCAD is covered by the new BSD license

# Copyright (c) 2008, Daniel Heeks
# All rights reserved.

# Once done, this will define
# OpenCASCADE_FOUND - true if OCC has been found
Expand Down
26 changes: 26 additions & 0 deletions cmake/FindOpenCASCADE.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
The file FindOpenCASCADE.cmake is taken and adapted from the HeeksCAD project (https://github.com/Heeks/heekscad).
The original file is covered by the new BSD license:

HeeksCAD is covered by the new BSD license

Copyright (c) 2008, Daniel Heeks
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Daniel Heeks nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if( T8CODE_ENABLE_NETCDF )
target_link_libraries( T8 PUBLIC netCDF::netcdf )
target_compile_definitions(T8 PUBLIC
T8_WITH_NETCDF
$<$<BOOL:${T8CODE_ENABLE_MPI}>:T8_WITH_NETCDF_PAR> )
$<$<AND:$<BOOL:${NETCDF_HAVE_NETCDF_PAR}>,$<BOOL:${T8CODE_ENABLE_MPI}>>:T8_WITH_NETCDF_PAR> )
endif()

set_target_properties( T8 PROPERTIES OUTPUT_NAME t8 )
Expand Down
11 changes: 11 additions & 0 deletions src/t8_geometry/t8_geometry_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ void
t8_geom_linear_interpolation (const double *coefficients, const double *corner_values, const int corner_value_dim,
const int interpolation_dim, double *evaluated_function)
{
T8_ASSERT (0 <= corner_value_dim && corner_value_dim <= 3);
T8_ASSERT (1 <= interpolation_dim && interpolation_dim <= 3);

/* Temporary storage for result. Using this allows evaluated_function to use the same space as
* coefficients or corner_values if needed. */
double temp[3] = { 0 };
for (int i_dim = 0; i_dim < corner_value_dim; i_dim++) {
temp[i_dim] = corner_values[0 * corner_value_dim + i_dim] * (1 - coefficients[0]) /* x=0 y=0 z=0 */
Expand Down Expand Up @@ -57,10 +62,16 @@ void
t8_geom_triangular_interpolation (const double *coefficients, const double *corner_values, const int corner_value_dim,
const int interpolation_dim, double *evaluated_function)
{
T8_ASSERT (0 <= corner_value_dim && corner_value_dim <= 3);
T8_ASSERT (2 <= interpolation_dim && interpolation_dim <= 3);

/* The algorithm is able to calculate any point in a triangle or tetrahedron using cartesian coordinates.
* All points are calculated by the sum of each corner point (e.g. p1 -> corner point 1) multiplied by a
* scalar, which in this case are the reference coordinates (ref_coords).
*/

/* Temporary storage for result. Using this allows evaluated_function to use the same space as
* coefficients or corner_values if needed. */
double temp[3] = { 0 };

for (int i_dim = 0; i_dim < corner_value_dim; i_dim++) {
Expand Down
4 changes: 2 additions & 2 deletions src/t8_vtk/t8_vtk_reader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ t8_vtkGrid_to_cmesh (vtkSmartPointer<vtkDataSet> vtkGrid, const int partition, c
}

/* Set the dimension on all procs (even empty procs). */
const int dim = num_trees > 0 ? t8_get_dimension (vtkGrid) : 0;
int dim = num_trees > 0 ? t8_get_dimension (vtkGrid) : 0;
int dim_buf = dim;
mpiret = sc_MPI_Allreduce (&dim, &dim_buf, 1, sc_MPI_INT, sc_MPI_MAX, comm);
mpiret = sc_MPI_Allreduce ((void *) &dim, &dim_buf, 1, sc_MPI_INT, sc_MPI_MAX, comm);
SC_CHECK_MPI (mpiret);
t8_cmesh_set_dimension (cmesh, dim_buf);

Expand Down

0 comments on commit 8c314e5

Please sign in to comment.