Commit 6f346d07 authored by Kirill Terekhov's avatar Kirill Terekhov

Some fixes for disabled components

Fix errors when any of USE_AUTODIFF, USE_SOLVER, USE_MESH or
USE_PARTITIONER are disabled.
parent 39dd0a0e
......@@ -16,4 +16,6 @@ add_subdirectory(ADFVDiscr)
add_subdirectory(ADMFD)
endif(USE_AUTODIFF AND USE_SOLVER AND USE_MESH)
#add_subdirectory(OctreeCutcell)
add_subdirectory(Octree)
\ No newline at end of file
if(USE_MESH AND USE_PARTITIONER)
add_subdirectory(Octree)
endif(USE_MESH AND USE_PARTITIONER)
\ No newline at end of file
#ifndef INMOST_DENSE_INCLUDED
#define INMOST_DENSE_INCLUDED
#include "inmost_common.h"
#if defined(USE_AUTODIFF)
#include "inmost_expression.h"
#endif
#include <iomanip>
......@@ -22,8 +20,6 @@ namespace INMOST
template<> struct Promote<variable, hessian_variable> {typedef hessian_variable type;};
template<> struct Promote<hessian_variable, variable> {typedef hessian_variable type;};
template<> struct Promote<hessian_variable, hessian_variable> {typedef hessian_variable type;};
#else
__INLINE INMOST_DATA_REAL_TYPE get_value(INMOST_DATA_REAL_TYPE x) {return x;}
#endif
template<typename Var, typename Storage = array<Var> >
......
......@@ -1938,6 +1938,14 @@ template<class A> __INLINE INMOST::function_expression<
__INLINE INMOST_DATA_REAL_TYPE get_table(INMOST_DATA_REAL_TYPE Arg, const INMOST::keyval_table & Table) {return Table.GetValue(Arg);}
#else //USE_AUTODIFF
__INLINE void assign(INMOST_DATA_REAL_TYPE & Arg, INMOST_DATA_REAL_TYPE Val) {Arg = Val;}
__INLINE void set_value(INMOST_DATA_REAL_TYPE & Arg, INMOST_DATA_REAL_TYPE Val) {Arg = Val;}
__INLINE INMOST_DATA_REAL_TYPE get_value(INMOST_DATA_REAL_TYPE Arg) {return Arg;}
__INLINE INMOST_DATA_REAL_TYPE variation(INMOST_DATA_REAL_TYPE Arg, INMOST_DATA_REAL_TYPE) {return Arg;}
__INLINE INMOST_DATA_REAL_TYPE soft_fabs(INMOST_DATA_REAL_TYPE Arg, INMOST_DATA_REAL_TYPE tol) {return ::sqrt(Arg*Arg+tol*tol);}
__INLINE INMOST_DATA_REAL_TYPE soft_sign(INMOST_DATA_REAL_TYPE Arg, INMOST_DATA_REAL_TYPE tol) {return Arg/::sqrt(Arg*Arg+tol*tol);}
__INLINE INMOST_DATA_REAL_TYPE soft_max(INMOST_DATA_REAL_TYPE Left, INMOST_DATA_REAL_TYPE Right, INMOST_DATA_REAL_TYPE tol) {return 0.5*(Left+Right+::sqrt((Left-Right)*(Left-Right)+tol*tol));}
__INLINE INMOST_DATA_REAL_TYPE soft_min(INMOST_DATA_REAL_TYPE Left, INMOST_DATA_REAL_TYPE Right, INMOST_DATA_REAL_TYPE tol) {return 0.5*(Left+Right-::sqrt((Left-Right)*(Left-Right)+tol*tol));}
#endif //USE_AUTODIFF
#endif //INMOST_AUTODIFF_ETEXPR_H_INCLUDED
......@@ -10,7 +10,7 @@ namespace INMOST
std::string ReferenceToString(INMOST::HandleType h, int pos);
#endif
#if defined(USE_AUTODIFF)
std::string VariableToString(INMOST::Storage::var v);
std::string VariableToString(INMOST::variable v);
#endif
......@@ -130,7 +130,7 @@ namespace INMOST
std::pair<std::string,std::pair<INMOST::ElementType,int> > atorh(const char * _str);
#endif
#if defined(USE_AUTODIFF)
INMOST::Storage::var atov(const char * _str);
INMOST::variable atov(const char * _str);
#endif
int EvaluateExpression(std::string expression);
int ConvertMultiplier(std::string expression, int SetSize);
......
......@@ -98,7 +98,7 @@ namespace INMOST
#if defined(USE_AUTODIFF)
std::string VariableToString(INMOST::Storage::var v)
std::string VariableToString(INMOST::variable v)
{
std::stringstream ret;
const INMOST::Sparse::Row & r = v.GetRow();
......@@ -1191,10 +1191,10 @@ namespace INMOST
#endif
#if defined(USE_AUTODIFF)
INMOST::Storage::var XMLReader::atov(const char * _str)
INMOST::variable XMLReader::atov(const char * _str)
{
INMOST::Sparse::Row entries;
INMOST::Storage::real val;
INMOST_DATA_REAL_TYPE val;
if( !(_str[0] == '(' && _str[strlen(_str)-1] == ')' ) ) Report("Expected scopes for variable %s",_str);
std::string str(_str+1,strlen(_str)-2);
std::vector<std::string> decomposed;
......
......@@ -12,6 +12,7 @@ set(HEADER
${CMAKE_CURRENT_SOURCE_DIR}/SolverMaster.h
${CMAKE_CURRENT_SOURCE_DIR}/SolverInterface.h)
if(USE_SOLVER)
add_subdirectory(solver_inner)
add_subdirectory(solver_fcbiilu2)
add_subdirectory(solver_k3biilu2)
......@@ -31,8 +32,8 @@ endif()
if (USE_SOLVER_SUPERLU)
add_subdirectory(solver_superlu)
endif()
endif(USE_SOLVER)
set(HEADER ${HEADER} PARENT_SCOPE)
set(SOURCE ${SOURCE} PARENT_SCOPE)
set(SOLVER_DEFINITIONS ${SOLVER_DEFINITIONS} PARENT_SCOPE)
\ No newline at end of file
set(SOLVER_DEFINITIONS ${SOLVER_DEFINITIONS} PARENT_SCOPE)
......@@ -3,6 +3,8 @@
#define GUARD_MPI(x) {ierr = x; if( ierr != MPI_SUCCESS ) {char str[4096]; int len; MPI_Error_string(ierr,str,&len); std::cout << #x << " not successfull: " << str << std::endl; MPI_Abort(comm,-1000);}}
#define HASH_TABLE_SIZE 2048
#if defined(USE_SOLVER)
namespace INMOST {
int comparator(const void *pa, const void *pb) {
......@@ -739,3 +741,4 @@ namespace INMOST {
}
#endif//USE_SOLVER
\ No newline at end of file
......@@ -6,10 +6,8 @@
#include "inmost_sparse.h"
#define SILENCE_SET_PARAMETER
namespace INMOST {
#if defined(USE_SOLVER)
namespace INMOST {
class SolverParameters {
public:
......@@ -78,7 +76,7 @@ namespace INMOST {
};
}
#endif
#endif //USE_SOLVER
#endif //INMOST_SOLVER_INTERFACE_H
#include "SolverMaster.h"
#if defined(USE_SOLVER)
#include "solver_inner/solver_ilu2/SolverILU2.h"
#include "solver_inner/solver_ddpqiluc2/SolverDDPQILUC2.h"
#include "solver_inner/solver_mptiluc/SolverMPTILUC.h"
......@@ -133,3 +133,4 @@ namespace INMOST {
}
#endif //USE_SOLVER
\ No newline at end of file
......@@ -2,7 +2,7 @@
#define INMOST_SOLVER_MASTER
#include <Source/Solver/SolverInterface.h>
#if defined(USE_SOLVER)
namespace INMOST {
class SolverMaster {
......@@ -14,5 +14,5 @@ namespace INMOST {
static bool isSolverAvailable(std::string name);
};
}
#endif //USE_SOLVER
#endif //INMOST_SOLVER_MASTER
#include "SolverInterface.h"
#if defined(USE_SOLVER)
namespace INMOST {
SolverParameters::SolverParameters(std::string solverName, std::string solverPrefix, std::string internalFile) : solverName(solverName),
......@@ -15,3 +15,4 @@ namespace INMOST {
SolverParameters::~SolverParameters() {}
}
#endif //USE_SOLVER
\ No newline at end of file
#include <inmost.h>
#include "SolverMaster.h"
#include "Source/Misc/utils.h"
#if defined(USE_SOLVER)
namespace INMOST {
......@@ -258,4 +258,6 @@ namespace INMOST {
}
}
\ No newline at end of file
}
#endif //USE_SOLVER
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment