Commit 6e87040c authored by Bert Vandenbroucke's avatar Bert Vandenbroucke
Browse files

Added skeleton 2D SHADOWFAX_SPH code + empty Voronoi2D unit test.

parent e611cd83
......@@ -76,6 +76,7 @@ tests/testRiemannTRRS
tests/testRiemannHLLC
tests/testMatrixInversion
tests/testVoronoi1D
tests/testVoronoi2D
tests/testVoronoi3D
tests/testDump
tests/testLogger
......
......@@ -17,8 +17,8 @@
*
******************************************************************************/
#ifndef SWIFT_VORONOI1D_ALGORITHM_H
#define SWIFT_VORONOI1D_ALGORITHM_H
#ifndef SWIFT_VORONOIXD_ALGORITHM_H
#define SWIFT_VORONOIXD_ALGORITHM_H
#include <float.h>
#include <math.h>
......@@ -178,4 +178,4 @@ __attribute__((always_inline)) INLINE void voronoi_get_centroid(
centroid[2] = 0.0f;
}
#endif // SWIFT_VORONOI1D_ALGORITHM_H
#endif // SWIFT_VORONOIXD_ALGORITHM_H
......@@ -17,8 +17,8 @@
*
******************************************************************************/
#ifndef SWIFT_VORONOI1D_CELL_H
#define SWIFT_VORONOI1D_CELL_H
#ifndef SWIFT_VORONOIXD_CELL_H
#define SWIFT_VORONOIXD_CELL_H
/* 1D Voronoi cell */
struct voronoi_cell {
......@@ -45,4 +45,4 @@ struct voronoi_cell {
float centroid;
};
#endif // SWIFT_VORONOI1D_CELL_H
#endif // SWIFT_VORONOIXD_CELL_H
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2017 Bert Vandenbroucke (bert.vandenbroucke@gmail.com).
*
* This program 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 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_VORONOIXD_ALGORITHM_H
#define SWIFT_VORONOIXD_ALGORITHM_H
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include "error.h"
#include "inline.h"
#include "voronoi2d_cell.h"
/**
* @brief Initialize a 2D Voronoi cell
*
* @param cell 2D Voronoi cell to initialize.
* @param x Position of the generator of the cell.
*/
__attribute__((always_inline)) INLINE void voronoi_cell_init(
struct voronoi_cell *cell, double *x) {}
/**
* @brief Interact a 2D Voronoi cell with a particle with given relative
* position and ID
*
* @param cell 2D Voronoi cell.
* @param dx Relative position of the interacting generator w.r.t. the cell
* generator (in fact: dx = generator - neighbour).
* @param id ID of the interacting neighbour.
*/
__attribute__((always_inline)) INLINE void voronoi_cell_interact(
struct voronoi_cell *cell, float *dx, unsigned long long id) {}
/**
* @brief Finalize a 2D Voronoi cell
*
* @param cell 2D Voronoi cell.
* @return Maximal radius that could still change the structure of the cell.
*/
__attribute__((always_inline)) INLINE float voronoi_cell_finalize(
struct voronoi_cell *cell) {
return 1.0f;
}
/**
* @brief Get the oriented surface area and midpoint of the face between a
* 2D Voronoi cell and the given neighbour
*
* @param cell 2D Voronoi cell.
* @param ngb ID of a particle that is possibly a neighbour of this cell.
* @param midpoint Array to store the relative position of the face in.
* @return 0 if the given neighbour is not a neighbour, surface area otherwise.
*/
__attribute__((always_inline)) INLINE float voronoi_get_face(
struct voronoi_cell *cell, unsigned long long ngb, float *midpoint) {
return 0.0f;
}
/**
* @brief Get the centroid of a 2D Voronoi cell
*
* @param cell 2D Voronoi cell.
* @param centroid Array to store the centroid in.
*/
__attribute__((always_inline)) INLINE void voronoi_get_centroid(
struct voronoi_cell *cell, float *centroid) {}
#endif // SWIFT_VORONOIXD_ALGORITHM_H
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2017 Bert Vandenbroucke (bert.vandenbroucke@gmail.com).
*
* This program 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 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_VORONOIXD_CELL_H
#define SWIFT_VORONOIXD_CELL_H
/* 2D Voronoi cell */
struct voronoi_cell {
/* The position of the generator of the cell. */
double x[2];
/* The "volume" of the 2D cell. */
float volume;
/* The centroid of the cell. */
float centroid[2];
};
#endif // SWIFT_VORONOIXD_CELL_H
......@@ -17,8 +17,8 @@
*
******************************************************************************/
#ifndef SWIFT_VORONOI3D_ALGORITHM_H
#define SWIFT_VORONOI3D_ALGORITHM_H
#ifndef SWIFT_VORONOIXD_ALGORITHM_H
#define SWIFT_VORONOIXD_ALGORITHM_H
#include <float.h>
#include <math.h>
......@@ -2035,4 +2035,4 @@ __attribute__((always_inline)) INLINE void voronoi_get_centroid(
centroid[2] = cell->centroid[2];
}
#endif // SWIFT_VORONOI3D_ALGORITHM_H
#endif // SWIFT_VORONOIXD_ALGORITHM_H
......@@ -17,8 +17,8 @@
*
******************************************************************************/
#ifndef SWIFT_VORONOI1D_CELL_H
#define SWIFT_VORONOI1D_CELL_H
#ifndef SWIFT_VORONOIXD_CELL_H
#define SWIFT_VORONOIXD_CELL_H
/* Maximal number of neighbours that can be stored in a voronoi_cell struct */
#define VORONOI3D_MAXNUMNGB 100
......@@ -134,4 +134,4 @@ __attribute__((always_inline)) INLINE void voronoi3d_cell_copy(
}
}
#endif // SWIFT_VORONOI1D_CELL_H
#endif // SWIFT_VORONOIXD_CELL_H
......@@ -23,7 +23,6 @@
#if defined(HYDRO_DIMENSION_1D)
#include "voronoi1d_algorithm.h"
#elif defined(HYDRO_DIMENSION_2D)
#warning "2D moving mesh not implemented yet!"
#include "voronoi2d_algorithm.h"
#elif defined(HYDRO_DIMENSION_3D)
#include "voronoi3d_algorithm.h"
......
......@@ -23,10 +23,9 @@
#if defined(HYDRO_DIMENSION_1D)
#include "voronoi1d_cell.h"
#elif defined(HYDRO_DIMENSION_2D)
#warning "2D moving mesh not implemented yet!"
#include "voronoi2d_cell.h"
#elif defined(HYDRO_DIMENSION_3D)
#include "voronoi3d_algorithm.h"
#include "voronoi3d_cell.h"
#else
#error "You have to select a dimension for the hydro!"
#endif
......
......@@ -26,7 +26,7 @@ TESTS = testGreetings testMaths testReading.sh testSingle testKernel testSymmetr
testParser.sh testSPHStep test125cells.sh testKernelGrav testFFT \
testAdiabaticIndex testRiemannExact testRiemannTRRS testRiemannHLLC \
testMatrixInversion testThreadpool testDump testLogger \
testVoronoi1D testVoronoi3D
testVoronoi1D testVoronoi2D testVoronoi3D
# List of test programs to compile
check_PROGRAMS = testGreetings testReading testSingle testTimeIntegration \
......@@ -35,7 +35,7 @@ check_PROGRAMS = testGreetings testReading testSingle testTimeIntegration \
testSymmetry testThreadpool benchmarkInteractions \
testAdiabaticIndex testRiemannExact testRiemannTRRS \
testRiemannHLLC testMatrixInversion testDump testLogger \
testVoronoi1D testVoronoi3D
testVoronoi1D testVoronoi2D testVoronoi3D
# Sources for the individual programs
testGreetings_SOURCES = testGreetings.c
......@@ -82,6 +82,8 @@ testMatrixInversion_SOURCES = testMatrixInversion.c
testVoronoi1D_SOURCES = testVoronoi1D.c
testVoronoi2D_SOURCES = testVoronoi2D.c
testVoronoi3D_SOURCES = testVoronoi3D.c
testThreadpool_SOURCES = testThreadpool.c
......
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (C) 2017 Bert Vandenbroucke (bert.vandenbroucke@gmail.com).
*
* This program 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 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#include "hydro/Shadowswift/voronoi2d_algorithm.h"
int main() { return 0; }
Supports Markdown
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