Commit 86c6fae9 authored by GILLES Sebastien's avatar GILLES Sebastien

#1221 Add Seldon and Ops as embedded libraries.

parent 2a4c91a9
......@@ -96,8 +96,8 @@ endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Sources /
${CMAKE_CURRENT_SOURCE_DIR}/Sources/ThirdParty/Source/Tclap/include /
${OPS_DIR} /
${SELDON_DIR} /
${CMAKE_CURRENT_SOURCE_DIR}/Sources/ThirdParty/Source/Ops /
${CMAKE_CURRENT_SOURCE_DIR}/Sources/ThirdParty/Source/Seldon /
${OPEN_MPI_INCL_DIR} /
${PETSC_GENERAL_INCL_DIR} /
${PETSC_SPECIFIC_INCL_DIR} /
......
......@@ -65,7 +65,7 @@
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "--input_parameters ${HOME}/Codes/MoReFEM/Sources/ModelInstances/Stokes/demo_input_stokes.lua"
argument = "--input_parameters ${HOME}/Codes/MoReFEM/CoreLibrary/Sources/ModelInstances/Stokes/demo_input_stokes.lua"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
......
A HPC finite element library developed for the implementation of the models of M3DISIM Inria team.
# Dependencies
MoReFEM relies on several third party libraries:
- An optimized Blas library. On macos you may use the Accelerate framework; Openblas has also been successfully tested.
- Ops:
third_party_build.BuildLibrary("Lua")
third_party_build.BuildLibrary("Boost")
third_party_build.CopyOps()
third_party_build.CopySeldon()
third_party_build.BuildLibrary("Openmpi")
third_party_build.BuildLibrary("Parmetis")
third_party_build.BuildLibrary("Superlu_dist")
third_party_build.BuildLibrary("Scalapack")
third_party_build.BuildLibrary("Mumps")
third_party_build.BuildLibrary("Petsc")
......@@ -66,9 +66,6 @@ def ReadConfigurationFile(configuration_file):
vars.Add(SCons.Variables.PathVariable('LUA_LIB_DIR', "Path to Lua library.", None))
vars.Add(SCons.Variables.PathVariable('BOOST_LIB_DIR', "Path to Boost library.", None))
vars.Add(SCons.Variables.PathVariable('OPS_DIR', "Path to Ops source files.", None))
vars.Add(SCons.Variables.PathVariable('SELDON_DIR', "Path to Seldon source files.", None))
vars.Add(SCons.Variables.BoolVariable('PHILLIPS_LINKER', "True if you want to link with the Phillips Library. Only works with gcc.", 0))
vars.Add(SCons.Variables.PathVariable('PHILLIPS_DIR', "Path to Phillips library and header. Might be 'None' if irrelevant", None, PathOrNone))
......
......@@ -335,8 +335,8 @@ def DefineEnvironment(vars, morefem_root = None):
env['PARMETIS_INCL_DIR'],
env['LUA_INCL_DIR'],
env['BOOST_INCL_DIR'],
env['OPS_DIR'],
env['SELDON_DIR'],
os.path.join(env['MOREFEM_ROOT'], 'Sources', 'ThirdParty', 'Source', 'Ops'),
os.path.join(env['MOREFEM_ROOT'], 'Sources', 'ThirdParty', 'Source', 'Seldon')
]
if env['PHILLIPS_DIR']:
......
......@@ -89,7 +89,7 @@ if __name__ == "__main__":
morefem_path = "${HOME}/Codes/Morefem/CoreLibrary"
GenerateInModule(morefem_path, "Utilities", "MOREFEM_UTILITIES", None)
GenerateInModule(morefem_path, "ThirdParty", "MOREFEM_UTILITIES", ['Tclap', 'Legacy'])
GenerateInModule(morefem_path, "ThirdParty", "MOREFEM_UTILITIES", ['Tclap', 'Source'])
GenerateInModule(morefem_path, "Core", "MOREFEM_CORE")
GenerateInModule(morefem_path, "Geometry", "MOREFEM_GEOMETRY")
GenerateInModule(morefem_path, "FiniteElement", "MOREFEM_FELT")
......
......@@ -31,8 +31,6 @@ endif()
include(Utilities/SourceList.cmake)
include(ThirdParty/SourceList.cmake)
include(ThirdParty/Ops.cmake)
include(ThirdParty/Seldon.cmake)
include(ThirdParty/Source/CMakeLists.txt)
include(Core/SourceList.cmake)
......
......@@ -17,4 +17,3 @@ include(${CMAKE_CURRENT_LIST_DIR}/LinearAlgebra/SourceList.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/InputParameterData/SourceList.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/InputParameter/SourceList.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/TimeManager/SourceList.cmake)
......@@ -67,7 +67,7 @@ for file in third_party_src_filter_out_warnings:
# Fetch also Ops source files and add them in the list:
third_party_build_directory = os.path.join(env['CURRENT_BUILD_INTERMEDIATE_DIR'], 'Ops')
ops_obj_list = SConscript(os.path.join(env['OPS_DIR'], 'MoReFEMSConscript'),
ops_obj_list = SConscript(os.path.join('Source', 'Ops', 'MoReFEMSConscript'),
'env',
variant_dir=third_party_build_directory,
duplicate=0)
......@@ -78,7 +78,7 @@ third_party_src_and_objects.extend(ops_obj_list)
# Likewise for Seldon.
third_party_build_directory = os.path.join(env['CURRENT_BUILD_INTERMEDIATE_DIR'], 'Seldon')
seldon_obj_list = SConscript(os.path.join(env['SELDON_DIR'], 'MoReFEMSConscript'),
seldon_obj_list = SConscript(os.path.join('Source', 'Seldon', 'MoReFEMSConscript'),
'env',
variant_dir=third_party_build_directory,
duplicate=0)
......
include(${CMAKE_CURRENT_LIST_DIR}/Lm6/CMakeLists.txt)
include(${CMAKE_CURRENT_LIST_DIR}/Ops/CMakeLists.txt)
include(${CMAKE_CURRENT_LIST_DIR}/Seldon/CMakeLists.txt)
\ No newline at end of file
target_sources(${MOREFEM_UTILITIES}
PUBLIC
)
......@@ -2,9 +2,9 @@ add_library(Ops ${LIBRARY_TYPE} "")
target_sources(Ops
PRIVATE
${OPS_DIR}/ClassOps.cpp /
${OPS_DIR}/Error.cpp /
${OPS_DIR}/Ops.cpp
"${CMAKE_CURRENT_LIST_DIR}/ClassOps.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Error.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Ops.cpp"
)
# Suppress all warnings from this third party library. PRIVATE is important not to propagate that to the MoReFEM libraries!
......
This diff is collapsed.
This diff is collapsed.
// Copyright (C) 2010, Vivien Mallet
//
// This file is part of Ops, a library for parsing Lua configuration files.
//
// Ops 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 2.1 of the License, or (at your option)
// any later version.
//
// Ops 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 Lesser General Public License for
// more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Ops. If not, see http://www.gnu.org/licenses/.
#ifndef OPS_FILE_CLASSOPS_HXX
namespace Ops
{
class Ops
{
protected:
//! Path to the configuration file.
string file_path_;
//! Lua state.
lua_State* state_;
//! Prefix to be prepended to the entries names.
string prefix_;
//! Names and values of all Booleans read in the file.
std::map<string, bool> read_bool;
//! Names and values of all integer read in the file.
std::map<string, int> read_int;
//! Names and values of all floats read in the file.
std::map<string, float> read_float;
//! Names and values of all doubles read in the file.
std::map<string, double> read_double;
//! Names and values of all strings read in the file.
std::map<string, string> read_string;
//! Names and values of all vectors of Booleans read in the file.
std::map<string, std::vector<bool> > read_vect_bool;
//! Names and values of all vectors of integers read in the file.
std::map<string, std::vector<int> > read_vect_int;
//! Names and values of all vectors of floats read in the file.
std::map<string, std::vector<float> > read_vect_float;
//! Names and values of all vectors of doubles read in the file.
std::map<string, std::vector<double> > read_vect_double;
//! Names and values of all vectors of strings read in the file.
std::map<string, std::vector<string> > read_vect_string;
public:
// Constructor and destructor.
Ops();
Ops(string file_path);
~Ops();
// Main methods.
void Open(string file_path, bool close_state = true);
void Reload(bool close_state = true);
void Close();
template<class TD, class T>
void
Set(string name, string constraint, const TD& default_value, T& value);
template<class T>
void Set(string name, string constraint, T& value);
template<class T>
void Set(string name, T& value);
template<class T>
T Get(string name);
template<class T>
T Get(string name, string constraint);
template<class T>
T Get(string name, string constraint, const T& default_value);
template<class Tin, class Tout>
void Apply(string name, const std::vector<Tin>& in,
std::vector<Tout>& OUTPUT);
template<class T>
T Apply(string name, const T& arg0);
template<class T>
T Apply(string name, const T& arg0, const T& arg1);
template<class T>
T Apply(string name, const T& arg0, const T& arg1, const T& arg2);
template<class T>
T Apply(string name, const T& arg0, const T& arg1, const T& arg2,
const T& arg3);
template<class T>
T Apply(string name, const T& arg0, const T& arg1, const T& arg2,
const T& arg3, const T& arg4);
std::vector<string> GetEntryList(string name = "");
bool CheckConstraint(string name, string constraint);
bool CheckConstraintOnValue(string value, string constraint);
void PutOnStack(string name);
bool Exists(string name);
void PushOnStack(bool value);
void PushOnStack(int value);
void PushOnStack(float value);
void PushOnStack(double value);
void PushOnStack(string value);
template<class T>
void PushOnStack(const std::vector<T>& v);
template<class T>
bool Is(string name);
bool IsTable(string name);
bool IsFunction(string name);
void ClearStack();
void DoFile(string file_path);
void DoString(string expression);
// Access methods.
string GetFilePath() const;
lua_State* GetState();
#ifndef SWIG
const lua_State* GetState() const;
#endif
string GetPrefix() const;
void SetPrefix(string prefix);
void ClearPrefix();
std::vector<string> GetReadEntryList();
void UpdateLuaDefinition();
string LuaDefinition(string name);
string LuaDefinition();
void WriteLuaDefinition(string file_name);
protected:
bool Convert(int index, std::vector<bool>::reference output,
string name = "");
bool Convert(int index, bool& output, string name = "");
bool Convert(int index, int& output, string name = "");
bool Convert(int index, float& output, string name = "");
bool Convert(int index, double& output, string name = "");
bool Convert(int index, string& output, string name = "");
template<class TD, class T>
void SetValue(string name, string constraint,
const TD& default_value, bool with_default, T& value);
template<class T>
void SetValue(string name, string constraint,
const std::vector<T>& default_value, bool with_default,
std::vector<T>& value);
string Constraint(string constraint) const;
string Name(const string& name) const;
string Entry(const string& name) const;
string Function(const string& name) const;
void WalkDown(string name);
template<class T>
bool IsParam(string name, T& value);
template<class T>
bool IsParam(string name, std::vector<T>&);
void Push(string name, const bool& value);
void Push(string name, const int& value);
void Push(string name, const float& value);
void Push(string name, const double& value);
void Push(string name, const string& value);
void Push(string name, const std::vector<bool>& value);
void Push(string name, const std::vector<int>& value);
void Push(string name, const std::vector<float>& value);
void Push(string name, const std::vector<double>& value);
void Push(string name, const std::vector<string>& value);
template<class TK, class T>
void AppendKey(const std::map<TK, T>& input, std::vector<TK>& vect);
};
}
#define OPS_FILE_CLASSOPS_HXX
#endif
// Copyright (C) 2010, Vivien Mallet
//
// This file is part of Ops, a library for parsing Lua configuration files.
//
// Ops 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 2.1 of the License, or (at your option)
// any later version.
//
// Ops 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 Lesser General Public License for
// more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Ops. If not, see http://www.gnu.org/licenses/.
#include "Ops.hxx"
#include "Error.hxx"
namespace Ops
{
//! Constructor.
/*! Error associated with both a function and a comment.
\param[in] function function in which the error occurred.
\param[in] comment comment associated with the error.
*/
Error::Error(string function, string comment):
function_(function), comment_(comment)
{
#ifdef OPS_WITH_ABORT
this->CoutWhat();
abort();
#endif
}
//! Destructor.
Error::~Error()
{
}
//! Delivers information about the error.
/*! \return The available information: the function and/or the comment.
*/
string Error::What() const
{
string message;
if (!function_.empty())
message += "Error in Ops::" + function_ + ".\n";
if (!comment_.empty())
message += " " + comment_;
return message;
}
//! Delivers information about the error.
/*! Displays available information: the function and/or the comment.
*/
void Error::CoutWhat()
{
std::cout << this->What() << std::endl;
}
} // namespace Ops.
// Copyright (C) 2010, Vivien Mallet
//
// This file is part of Ops, a library for parsing Lua configuration files.
//
// Ops 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 2.1 of the License, or (at your option)
// any later version.
//
// Ops 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 Lesser General Public License for
// more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Ops. If not, see http://www.gnu.org/licenses/.
#ifndef OPS_FILE_ERROR_HXX