Skip to content

Commit

Permalink
More work toward Schism Formulation implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilMiller committed Jun 26, 2024
1 parent 7cb74d7 commit 24cb892
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ add_subdirectory("src/core")
add_subdirectory("src/geojson")
add_subdirectory("src/bmi")
add_subdirectory("src/realizations/catchment")
add_subdirectory("src/realizations/coastal")
add_subdirectory("src/forcing")
add_subdirectory("src/utilities/mdarray")
add_subdirectory("src/utilities/mdframe")
Expand Down
5 changes: 4 additions & 1 deletion include/realizations/coastal/SchismFormulation.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <NGenConfig.h>

#include <realizations/coastal/CoastalFormulation.hpp>
#include <bmi/Bmi_Fortran_Adapter.hpp>
#include <memory>
Expand All @@ -9,7 +11,8 @@ class SchismFormulation : public CoastalFormulation
public:
using MeshPointsDataProvider = data_access::DataProvider<double, MeshPointsSelector>;
SchismFormulation(
std::string id
std::string const& id
, std::string const& init_config_path
, std::shared_ptr<MeshPointsDataProvider> met_forcings
, std::shared_ptr<MeshPointsDataProvider> offshore_boundary
, std::shared_ptr<MeshPointsDataProvider> inflow_boundary
Expand Down
22 changes: 22 additions & 0 deletions src/realizations/coastal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
include(${PROJECT_SOURCE_DIR}/cmake/dynamic_sourced_library.cmake)
dynamic_sourced_cxx_library(realizations_coastal "${CMAKE_CURRENT_SOURCE_DIR}")

add_library(NGen::realizations_coastal ALIAS realizations_coastal)

target_include_directories(realizations_coastal PUBLIC
${PROJECT_SOURCE_DIR}/include/core
${PROJECT_SOURCE_DIR}/include/realizations/coastal
${PROJECT_SOURCE_DIR}/include/forcing
${PROJECT_SOURCE_DIR}/include/simulation_time
${PROJECT_SOURCE_DIR}/include/utilities
${PROJECT_SOURCE_DIR}/include/bmi
)

target_link_libraries(realizations_coastal PUBLIC
${CMAKE_DL_LIBS}
NGen::config_header
NGen::geojson
NGen::logging
NGen::ngen_bmi
)

27 changes: 27 additions & 0 deletions src/realizations/coastal/SchismFormulation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <realizations/coastal/SchismFormulation.hpp>

const static auto library_path = "/path/to/built/libpschism.so";
const static auto schism_registration_function = "schism_registration_function";

SchismFormulation::SchismFormulation(
std::string const& id
, std::string const& init_config_path
, std::shared_ptr<MeshPointsDataProvider> met_forcings
, std::shared_ptr<MeshPointsDataProvider> offshore_boundary
, std::shared_ptr<MeshPointsDataProvider> inflow_boundary
)
: CoastalFormulation(id)
, meteorological_forcings_provider_(met_forcings)
, offshore_boundary_provider_(offshore_boundary)
, inflows_boundary_provider_(inflow_boundary)
{
bmi_ = std::make_unique<models::bmi::Bmi_Fortran_Adapter>
(
"schism_formulation"
, library_path
, init_config_path
, true // allow_model_exceed_end_time
, true // model_time_step_fixed
, schism_registration_function
);
}

0 comments on commit 24cb892

Please sign in to comment.