feat(main): initial commit
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
# MFEM_example_template
|
||||
# Template MFEM Example repository
|
||||
This repository serves as a template for simple MFEM tests in the SERiF ecosystem. This is an exploratory and testing tool not a science tool
|
||||
|
||||
|
||||
2
build-config/CLI11/meson.build
Normal file
2
build-config/CLI11/meson.build
Normal file
@@ -0,0 +1,2 @@
|
||||
cli11_proj = subproject('cli11')
|
||||
cli11_dep = cli11_proj.get_variable('CLI11_dep')
|
||||
2
build-config/gridfire/meson.build
Normal file
2
build-config/gridfire/meson.build
Normal file
@@ -0,0 +1,2 @@
|
||||
gridfire_sp = subproject('gridfire', default_options: ['log_level=error', 'build_python=false', 'build_tests=false', 'build_examples=false', 'build_c_api=false', 'build_tools=false', 'openmp_support=true'])
|
||||
gridfire_dep = gridfire_sp.get_variable('gridfire_dep')
|
||||
13
build-config/libcomposition/meson.build
Normal file
13
build-config/libcomposition/meson.build
Normal file
@@ -0,0 +1,13 @@
|
||||
composition_p = subproject('libcomposition',
|
||||
default_options: [
|
||||
'pkg_config=false',
|
||||
'build_tests=false',
|
||||
'build_examples=false'
|
||||
])
|
||||
comp_dep = composition_p.get_variable('composition_dep')
|
||||
libcomposition = composition_p.get_variable('libcomposition')
|
||||
spw_dep = composition_p.get_variable('species_weight_dep')
|
||||
composition_dep = [
|
||||
comp_dep,
|
||||
spw_dep,
|
||||
]
|
||||
8
build-config/libconfig/meson.build
Normal file
8
build-config/libconfig/meson.build
Normal file
@@ -0,0 +1,8 @@
|
||||
config_p = subproject('libconfig',
|
||||
default_options:[
|
||||
'default_library=static',
|
||||
'pkg_config=false',
|
||||
'build_tests=false',
|
||||
'build_examples=false'
|
||||
])
|
||||
config_dep = config_p.get_variable('config_dep')
|
||||
5
build-config/meson.build
Normal file
5
build-config/meson.build
Normal file
@@ -0,0 +1,5 @@
|
||||
subdir('mfem')
|
||||
subdir('libconfig')
|
||||
subdir('CLI11')
|
||||
subdir('libcomposition')
|
||||
subdir('gridfire')
|
||||
16
build-config/mfem/meson.build
Normal file
16
build-config/mfem/meson.build
Normal file
@@ -0,0 +1,16 @@
|
||||
cmake = import('cmake')
|
||||
mfem_cmake_options = cmake.subproject_options()
|
||||
mfem_cmake_options.add_cmake_defines({
|
||||
'MFEM_ENABLE_EXAMPLES': 'OFF',
|
||||
'MFEM_ENABLE_TESTING': 'OFF',
|
||||
'MFEM_ENABLE_MINIAPPS': 'OFF',
|
||||
'MFEM_USE_BENCMARK': 'OFF',
|
||||
'BUILD_SHARED_LIBS': 'OFF',
|
||||
'BUILD_STATIC_LIBS': 'ON',
|
||||
})
|
||||
mfem_cmake_options.set_install(true)
|
||||
|
||||
mfem_sp = cmake.subproject(
|
||||
'mfem',
|
||||
options: mfem_cmake_options)
|
||||
mfem_dep = mfem_sp.dependency('mfem')
|
||||
10
default.toml
Normal file
10
default.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[main]
|
||||
core_steepness = 1.0
|
||||
flattening = 0.0
|
||||
include_external_domain = false
|
||||
order = 3
|
||||
r_core = 1.5
|
||||
r_infinity = 6.0
|
||||
r_instability = 1e-14
|
||||
r_star = 5.0
|
||||
refinement_levels = 3
|
||||
63
main.cpp
Normal file
63
main.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
#include "mfem.hpp"
|
||||
#include "fourdst/config/config.h"
|
||||
#include "CLI/CLI.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
||||
struct Options {
|
||||
std::string input_mesh = "stroid.mesh";
|
||||
std::string vishost = "localhost";
|
||||
int visport = 19916;
|
||||
};
|
||||
|
||||
void ViewMesh(
|
||||
const std::string& vishost,
|
||||
int visport,
|
||||
const mfem::Mesh& mesh,
|
||||
mfem::GridFunction& gf,
|
||||
const std::string& title,
|
||||
bool first_step = true
|
||||
) {
|
||||
mfem::socketstream sol_sock(vishost.c_str(), visport);
|
||||
if (!sol_sock.is_open()) {
|
||||
std::cerr << "Unable to connect to GLVis server at "
|
||||
<< vishost << ':' << visport << std::endl;
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
sol_sock.precision(8);
|
||||
sol_sock << "solution\n" << mesh << gf;
|
||||
if (first_step) {
|
||||
sol_sock << "window_title '" << title << "'\n";
|
||||
sol_sock << "keys 'iIzzMaagpmtppc'";
|
||||
}
|
||||
sol_sock << std::flush;
|
||||
}
|
||||
|
||||
std::unique_ptr<mfem::Mesh> load_mesh(const std::string& filename) {
|
||||
return std::make_unique<mfem::Mesh>(filename.c_str());
|
||||
}
|
||||
|
||||
void project_radial_function(mfem::GridFunction& gf, std::function<double(const mfem::Vector& x)> g) {
|
||||
mfem::FunctionCoefficient density_coeff([g](const mfem::Vector& x) {
|
||||
return g(x);
|
||||
});
|
||||
|
||||
gf.ProjectCoefficient(density_coeff);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(const int argc, char** argv) {
|
||||
CLI::App app("MFEM_EXAMPLE");
|
||||
|
||||
fourdst::config::Config<Options> config;
|
||||
fourdst::config::register_as_cli(config, app);
|
||||
CLI11_PARSE(app, argc, argv);
|
||||
|
||||
auto mesh = load_mesh(config->input_mesh);
|
||||
|
||||
const mfem::H1_FECollection fec(1, mesh->Dimension());
|
||||
mfem::FiniteElementSpace fes(mesh.get(), &fec);
|
||||
mfem::GridFunction rho_gf(&fes);
|
||||
}
|
||||
8
meson.build
Normal file
8
meson.build
Normal file
@@ -0,0 +1,8 @@
|
||||
project('mfem_test', ['cpp', 'c'], version: 'v0.1.0', default_options: ['cpp_std=c++23'], meson_version: '>=1.5.0')
|
||||
|
||||
add_project_arguments('-fvisibility=default', language: 'cpp')
|
||||
|
||||
subdir('build-config')
|
||||
|
||||
executable('main', 'main.cpp', dependencies: [mfem_dep, cli11_dep, config_dep, composition_dep, gridfire_dep])
|
||||
|
||||
299852
stroid.mesh
Normal file
299852
stroid.mesh
Normal file
File diff suppressed because it is too large
Load Diff
10
subprojects/cli11.wrap
Normal file
10
subprojects/cli11.wrap
Normal file
@@ -0,0 +1,10 @@
|
||||
[wrap-file]
|
||||
directory = CLI11-2.6.1
|
||||
source_url = https://github.com/CLIUtils/CLI11/archive/refs/tags/v2.6.1.tar.gz
|
||||
source_filename = CLI11-2.6.1.tar.gz
|
||||
source_hash = 377691f3fac2b340f12a2f79f523c780564578ba3d6eaf5238e9f35895d5ba95
|
||||
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/cli11_2.6.1-1/CLI11-2.6.1.tar.gz
|
||||
wrapdb_version = 2.6.1-1
|
||||
|
||||
[provide]
|
||||
dependency_names = CLI11
|
||||
7
subprojects/gridfire.wrap
Normal file
7
subprojects/gridfire.wrap
Normal file
@@ -0,0 +1,7 @@
|
||||
[wrap-git]
|
||||
url = https://github.com/4D-STAR/GridFire
|
||||
revision = v0.7.6rc3.3
|
||||
depth = 1
|
||||
|
||||
[provide]
|
||||
gridfire = gridfire_dep
|
||||
4
subprojects/libconfig.wrap
Normal file
4
subprojects/libconfig.wrap
Normal file
@@ -0,0 +1,4 @@
|
||||
[wrap-git]
|
||||
url = https://github.com/4D-STAR/libconfig.git
|
||||
revision = v2.1.0
|
||||
depth = 1
|
||||
7
subprojects/mfem.wrap
Normal file
7
subprojects/mfem.wrap
Normal file
@@ -0,0 +1,7 @@
|
||||
[wrap-git]
|
||||
url = https://github.com/mfem/mfem.git
|
||||
revision = v4.8-rc0
|
||||
diff_files = mfem/disable_mfem_selfcheck.patch
|
||||
depth = 1
|
||||
|
||||
[cmake]
|
||||
Reference in New Issue
Block a user