Skip to content

Commit

Permalink
Add FiniteElementMethodSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
paxbun committed Dec 22, 2021
1 parent 9ed3c9c commit 19e4903
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 4 deletions.
20 changes: 17 additions & 3 deletions server/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,26 @@ fn link_cplusplus() {

fn run_cmake(source_dir: &str, target_name: &str) {
let sources = [
// Header files
"FiniteElementMethodSpace.hh",
"IntegerTypes.hh",
"Lib.hh",
"MockSpace.cc",
"MockSpace.hh",
"Server.cc",
"MatrixSpace.hh",
"MonteCarloSpace.hh",
"Point.hh",
"Server.hh",
"Space.hh",
"SuccessiveOverRelaxationSpace.hh",

// Source files
"Config.cc",
"FiniteElementMethodSpace.cc",
"MatrixSpace.cc",
"MonteCarloSpace.cc",
"Server.cc",
"SuccessiveOverRelaxationSpace.cc",

// CMake
"CMakeLists.txt",
];
for src in sources.iter() {
Expand Down
1 change: 1 addition & 0 deletions server/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ add_library(
${CMAKE_SOURCE_DIR}/Source/Server.cc

# Spaces
${CMAKE_SOURCE_DIR}/Source/FiniteElementMethodSpace.cc
${CMAKE_SOURCE_DIR}/Source/MatrixSpace.cc
${CMAKE_SOURCE_DIR}/Source/MonteCarloSpace.cc
${CMAKE_SOURCE_DIR}/Source/SuccessiveOverRelaxationSpace.cc
Expand Down
22 changes: 22 additions & 0 deletions server/core/Public/leth/FiniteElementMethodSpace.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) 2021 Chanjung Kim. All rights reserved.
// Licensed under the MIT License.

#ifndef LAPLACE_EQ_THERM_SERVER_CORE_FINITE_ELEMENT_METHOD_SPACE_HH
#define LAPLACE_EQ_THERM_SERVER_CORE_FINITE_ELEMENT_METHOD_SPACE_HH

#include <leth/Space.hh>

class FiniteElementMethodSpace : public Space
{
public:
FiniteElementMethodSpace(uint16_t width, uint16_t height);

protected:
virtual char const* GetName() noexcept override;

virtual char const* GetErrorMessage(ErrorCode errorCode) noexcept override final;

virtual ErrorCode RunSimulation(Point const* input, float* output) noexcept override final;
};

#endif
5 changes: 4 additions & 1 deletion server/core/Source/Config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
#include <leth/Server.hh>

// Spaces
#include <leth/FiniteElementMethodSpace.hh>
#include <leth/MonteCarloSpace.hh>
#include <leth/SuccessiveOverRelaxationSpace.hh>


ServerHandle leth_create(uint16_t width, uint16_t height) noexcept
try
{
return Server::Make<MonteCarloSpace, SuccessiveOverRelaxationSpace>(width, height);
return Server::Make<MonteCarloSpace, SuccessiveOverRelaxationSpace, FiniteElementMethodSpace>(
width, height);
}
catch (...)
{
Expand Down
26 changes: 26 additions & 0 deletions server/core/Source/FiniteElementMethodSpace.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) 2021 Chanjung Kim. All rights reserved.
// Licensed under the MIT License.

#include <leth/FiniteElementMethodSpace.hh>

FiniteElementMethodSpace::FiniteElementMethodSpace(uint16_t width, uint16_t height) :
Space { width, height }
{}

char const* FiniteElementMethodSpace::GetName() noexcept
{
return "FiniteElementMethodSpace";
}

char const* FiniteElementMethodSpace::GetErrorMessage(ErrorCode errorCode) noexcept
{
if (errorCode == 0)
return "Success";

return "UnknownError";
}

ErrorCode FiniteElementMethodSpace::RunSimulation(Point const* input, float* output) noexcept
{
return 0;
}

0 comments on commit 19e4903

Please sign in to comment.