Skip to content

Commit

Permalink
Merge pull request #349 from ls1mardyn/crashPlugins
Browse files Browse the repository at this point in the history
Crash Disabled Plugins
  • Loading branch information
FG-TUM authored Nov 25, 2024
2 parents 87024df + 57e3153 commit 0e08636
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ls1_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ jobs:
sudo apt-get install -y \
libcppunit-dev \
libopenmpi-dev \
libomp-dev
libomp-dev \
libxerces-c-dev
echo "Running ${JOBNAME}"
git status
mkdir build_${JOBNAME}
Expand Down Expand Up @@ -89,6 +90,7 @@ jobs:
-DOPENMP=${{ matrix.openmp }} \
-DENABLE_MPI=$mpi_enabled \
-DENABLE_UNIT_TESTS=ON \
-DENABLE_VTK=ON \
..
cmake --build . --parallel 1
Expand Down Expand Up @@ -149,6 +151,7 @@ jobs:
-DENABLE_ALLLBL=$alllbl_enabled \
-DOPENMP=${{ matrix.openmp }} \
-DENABLE_MPI=$mpi_enabled \
-DENABLE_VTK=ON \
..
cmake --build . --parallel 1
Expand Down
16 changes: 8 additions & 8 deletions src/plugins/PluginFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,17 @@ long PluginFactory<PluginBase>::enablePlugins(std::list<PluginBase*>& _plugins,
}
Log::global_log->info() << "Enabling plugin: " << pluginname << std::endl;

PluginBase* plugin = this->create(pluginname);
if (plugin == nullptr) {
Log::global_log->warning() << "Could not create plugin using factory: " << pluginname << std::endl;
// Allowing an alias for a plugin. Not sure why this exists...
if (pluginname == "DomainProfiles") {
pluginname = "DensityProfileWriter";
Log::global_log->warning() << "DomainProfiles doesn't exist but is mapped to DensityProfileWriter!\n";
}

PluginBase* plugin = this->create(pluginname);

//@TODO: add plugin specific functions

// Special treatment of complex plugins
if (pluginname == "MmpldWriter") {
// @todo this should be handled in the MMPLD Writer readXML()
std::string sphere_representation = "simple";
Expand All @@ -196,13 +200,9 @@ long PluginFactory<PluginBase>::enablePlugins(std::list<PluginBase*>& _plugins,
error_message << "[MMPLD Writer] Unknown sphere representation type: " << sphere_representation << std::endl;
MARDYN_EXIT(error_message.str());
}
} else if (pluginname == "DomainProfiles") {
plugin = this->create("DensityProfileWriter");
// TODO: add _domain access (via Simularion)
_domain->readXML(xmlconfig);
}

if (nullptr != plugin) {
if (plugin) {
plugin->readXML(xmlconfig);
_plugins.push_back(plugin);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/PluginFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ typedef T* createInstanceFunc();
if( existing != _pluginFactoryMap.end() ) {
return existing->second(); /* call createInstance for plugin */
}
Log::global_log->warning() << "Plugin not found: " << pluginname << std::endl;
MARDYN_EXIT("Requested plugin not found: " + pluginname + ". Is it enabled in CMake?");
return nullptr;
}

Expand Down

0 comments on commit 0e08636

Please sign in to comment.