Skip to content
Snippets Groups Projects
Commit e166c51c authored by James Willis's avatar James Willis
Browse files

Created an interface for VELOCIraptor.

parent 292bcc6b
No related branches found
No related tags found
1 merge request!578Swift velociraptor
......@@ -47,7 +47,7 @@ include_HEADERS = space.h runner.h queue.h task.h lock.h cell.h part.h const.h \
sourceterms_struct.h statistics.h memswap.h cache.h runner_doiact_vec.h profiler.h \
dump.h logger.h active.h timeline.h xmf.h gravity_properties.h gravity_derivatives.h \
gravity_softened_derivatives.h vector_power.h collectgroup.h hydro_space.h sort_part.h \
chemistry.h chemistry_io.h chemistry_struct.h restart.h
chemistry.h chemistry_io.h chemistry_struct.h restart.h velociraptor_interface.h
# Common source files
AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \
......@@ -59,7 +59,7 @@ AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \
statistics.c runner_doiact_vec.c profiler.c dump.c logger.c \
part_type.c xmf.c gravity_properties.c gravity.c \
collectgroup.c hydro_space.c equation_of_state.c \
chemistry.c restart.c
chemistry.c restart.c velociraptor_interface.c
# Include files for distribution, not installation.
nobase_noinst_HEADERS = align.h approx_math.h atomic.h barrier.h cycle.h error.h inline.h kernel_hydro.h kernel_gravity.h \
......
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk)
* Matthieu Schaller (matthieu.schaller@durham.ac.uk)
* 2015 Peter W. Draper (p.w.draper@durham.ac.uk)
* Angus Lepper (angus.lepper@ed.ac.uk)
* 2016 John A. Regan (john.a.regan@durham.ac.uk)
* Tom Theuns (tom.theuns@durham.ac.uk)
*
* 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/>.
*
******************************************************************************/
/* Config parameters. */
#include "../config.h"
/* This object's header. */
#include "velociraptor_interface.h"
/**
* @brief Initialise VELOCIraptor with input and output file names along with cosmological info needed to run.
*
* @param e The #engine.
*
*/
void init_velociraptor(struct engine *e) {
struct cosmoinfo cosmo_info;
struct unitinfo unit_info;
struct siminfo sim_info;
cosmo_info.atime = 1.0;
unit_info.lengthtokpc = 1.0;
sim_info.period = 1.0;
InitVelociraptor("stf_input.cfg", "stf_ouput.out", cosmo_info, unit_info, sim_info);
}
/**
* @brief Run VELOCIraptor with current particle data.
*
* @param e The #engine.
*
*/
void invoke_velociraptor(struct engine *e) {
struct gpart *gparts = e->s->gparts;
const int nr_gparts = e->s->nr_gparts;
InvokeVelociraptor(nr_gparts, gparts);
}
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk)
* Matthieu Schaller (matthieu.schaller@durham.ac.uk)
* 2015 Peter W. Draper (p.w.draper@durham.ac.uk)
* Angus Lepper (angus.lepper@ed.ac.uk)
* 2016 John A. Regan (john.a.regan@durham.ac.uk)
* Tom Theuns (tom.theuns@durham.ac.uk)
*
* 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_VELOCIRAPTOR_INTERFACE_H
#define SWIFT_VELOCIRAPTOR_INTERFACE_H
/* Config parameters. */
#include "../config.h"
/* Includes. */
#include "engine.h"
/* Structure for passing cosmological information to VELOCIraptor. */
struct cosmoinfo {
double atime, littleh, Omega_m, Omega_b, Omega_Lambda, Omega_cdm, w_de;
};
/* Structure for passing unit information to VELOCIraptor. */
struct unitinfo {
double lengthtokpc,velocitytokms,masstosolarmass,gravity,hubbleunit;
};
/* Structure for passing simulation information to VELOCIraptor. */
struct siminfo {
double period, zoomhigresolutionmass, interparticlespacing;
int icosmologicalsim;
};
/* VELOCIraptor interface. */
void InitVelociraptor(char* config_name, char* output_name, struct cosmoinfo cosmo_info, struct unitinfo unit_info, struct siminfo sim_info);
void InvokeVelociraptor(const int num_gravity_parts, struct gpart *gravity_parts);
/* VELOCIraptor wrapper functions. */
void init_velociraptor(struct engine *e);
void invoke_velociraptor(struct engine *e);
#endif /* SWIFT_VELOCIRAPTOR_INTERFACE_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment