Skip to content

Commit 8146e51

Browse files
author
Dilawar Singh
committed
'ode_method' is available in rdesineur.
Fixed compilation process; merged master branch.
1 parent fe5e206 commit 8146e51

File tree

19 files changed

+471
-877
lines changed

19 files changed

+471
-877
lines changed

CMakeLists.txt

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,15 @@ if(WITH_BOOST)
119119
endif(WITH_BOOST)
120120

121121
# If using BOOST ODE2 library to solve ODE system, then don't use GSL.
122-
if(WITH_BOOST_ODE OR WITH_BOOST)
123-
message(STATUS "Turning off GSL")
122+
if(WITH_BOOST_ODE)
124123
set(WITH_GSL OFF)
125-
endif()
124+
endif(WITH_BOOST_ODE)
126125

127126
set_target_properties(libmoose PROPERTIES COMPILE_DEFINITIONS "MOOSE_LIB")
128127
set_target_properties(libmoose PROPERTIES PREFIX "")
129128

130129
## Variable to collect all static libraries.
131130
set(STATIC_LIBRARIES "" )
132-
133131
# Collect all shared libraries here.
134132
set(SYSTEM_SHARED_LIBS ${LibXML2_LIBRARIES})
135133

@@ -179,16 +177,14 @@ if(WITH_MPI)
179177
endif()
180178
endif(WITH_MPI)
181179

182-
if(WITH_BOOST OR WITH_BOOST_ODE)
180+
if(WITH_BOOST_ODE)
183181
list(APPEND SYSTEM_SHARED_LIBS ${LAPACK_LIBRARIES})
184182
list(APPEND SYSTEM_SHARED_LIBS ${Boost_LIBRARIES})
185183
endif(WITH_BOOST_ODE)
186184

187185
find_package( Threads )
188186
list(APPEND SYSTEM_SHARED_LIBS ${CMAKE_THREAD_LIBS_INIT})
189187

190-
list(APPEND SYSTEM_SHARED_LIBS ${CMAKE_THREAD_LIBS_INIT})
191-
192188
# These libraries could be static of dynamic. We need to discrimate between
193189
# these two types because of --whole-archive option. See
194190
# BhallaLab/moose-core#66,
@@ -240,10 +236,6 @@ add_subdirectory(kinetics)
240236
add_subdirectory(synapse)
241237
add_subdirectory(intfire)
242238
add_subdirectory(external/libsoda)
243-
add_subdirectory(external/muparser)
244-
245-
list(APPEND MOOSE_LIBRARIES muparser)
246-
247239

248240
###################################### LINKING #################################
249241
list(APPEND MOOSE_LIBRARIES
@@ -273,7 +265,7 @@ list(APPEND MOOSE_LIBRARIES
273265
list(REMOVE_DUPLICATES STATIC_LIBRARIES)
274266
if(SYSTEM_SHARED_LIBS)
275267
list(REMOVE_DUPLICATES SYSTEM_SHARED_LIBS)
276-
endif()
268+
endif( )
277269

278270
# cmake --help-policy CMP0042. Also in pymoose/CMakeLists.txt
279271
# More details:
@@ -312,7 +304,7 @@ target_link_libraries(moose.bin moose ${CMAKE_DL_LIBS})
312304

313305
if( WITH_BOOST )
314306
target_link_libraries( moose.bin ${Boost_LIBRARIES} )
315-
endif( )
307+
endif( WITH_BOOST )
316308

317309

318310
######################### BUILD PYMOOSE ########################################

basecode/global.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ namespace moose
6565

6666
extern map<string, valarray<double>> solverProfMap;
6767

68-
extern map<string, valarray<double>> solverProfMap;
69-
7068
/**
7169
* @brief A global seed for all RNGs in moose. When moose.seed( x ) is called,
7270
* this variable is set. Other's RNGs (except muparser) uses this seed to

external/libsoda/CMakeLists.txt

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,16 @@
11
cmake_minimum_required(VERSION 2.8)
22

3-
set(CMAKE_BUILD_TYPE Release)
4-
add_definitions( -std=c++11 )
5-
6-
add_library( lsoda ${CMAKE_CURRENT_SOURCE_DIR}/LSODA.cpp)
7-
8-
if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" )
9-
message( STATUS "Building for release" )
10-
set_target_properties( lsoda PROPERTIES COMPILE_FLAGS "-Werror -Wall")
11-
else()
12-
message( STATUS "Building for DEBUG mode" )
13-
endif()
3+
add_library(lsoda ${CMAKE_CURRENT_SOURCE_DIR}/LSODA.cpp)
144

155
find_package(Threads REQUIRED)
166

17-
add_executable( test_lsoda ${CMAKE_CURRENT_SOURCE_DIR}/test_LSODA.cpp)
18-
target_link_libraries( test_lsoda lsoda )
7+
add_executable(test_lsoda test_LSODA.cpp)
8+
target_link_libraries(test_lsoda lsoda)
199

20-
add_executable( benchmark_lsoda ${CMAKE_CURRENT_SOURCE_DIR}/benchmark_LSODA.cpp)
21-
target_link_libraries( benchmark_lsoda lsoda )
22-
23-
set_target_properties(test_lsoda PROPERTIES COMPILE_FLAGS "-g -UNDEBUG" )
24-
set_target_properties(benchmark_lsoda
25-
PROPERTIES COMPILE_FLAGS "-O3" LINK_FLAGS "-pthread"
26-
)
10+
add_executable(benchmark_lsoda benchmark_LSODA.cpp)
11+
target_link_libraries(benchmark_lsoda lsoda)
2712
target_link_libraries(benchmark_lsoda ${CMAKE_THREAD_LIBS_INIT})
2813

2914
enable_testing()
3015
add_test(NAME test_lsoda COMMAND $<TARGET_FILE:test_lsoda>)
3116
add_test(NAME test_benchmark COMMAND $<TARGET_FILE:benchmark_lsoda>)
32-

ksolve/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include( ${CMAKE_CURRENT_SOURCE_DIR}/../CheckCXXCompiler.cmake)
44

55
if(WITH_BOOST)
66
find_package(Boost 1.53 REQUIRED COMPONENTS thread)
7-
add_definitions( -DUSE_BOOST_ASYNC )
7+
add_definitions(-DUSE_BOOST )
88
set(WITH_BOOST_ODE ON)
99
include_directories( ${Boost_INCLUDE_DIRS} )
1010
# This is still not part of official bindings.
@@ -18,7 +18,7 @@ if(WITH_BOOST_ODE)
1818
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../external/boost-numeric-bindings)
1919
elseif(WITH_GSL)
2020
include_directories( ${GSL_INCLUDE_DIRS} )
21-
add_definitions(-DUSE_GSL -UUSE_BOOST_ODE)
21+
add_definitions(-DUSE_GSL -UUSE_BOOST_ODE -UUSE_BOOST)
2222
endif(WITH_BOOST_ODE)
2323

2424
set(KSOLVE_SRCS

ksolve/Gsolve.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -562,18 +562,6 @@ size_t Gsolve::advance_chunk( const size_t begin, const size_t end, ProcPtr p )
562562
return tot;
563563
}
564564

565-
void Gsolve::recalcTimeChunk( const size_t begin, const size_t end, ProcPtr p)
566-
{
567-
for (size_t i = begin; i < std::min(pools_.size(), end); i++)
568-
pools_[i].recalcTime( &sys_, p->currTime );
569-
}
570-
571-
void Gsolve::advance_chunk( const size_t begin, const size_t end, ProcPtr p )
572-
{
573-
for (size_t i = begin; i < std::min(end, pools_.size() ); i++)
574-
pools_[i].advance( p, &sys_ );
575-
}
576-
577565
void Gsolve::reinit( const Eref& e, ProcPtr p )
578566
{
579567
if ( !stoichPtr_ )
@@ -903,8 +891,7 @@ void Gsolve::makeReacDepsUnique()
903891
vector< unsigned int >& dep = sys_.dependency[ i ];
904892
// Here we want to remove self-entries as well as duplicates.
905893
sort( dep.begin(), dep.end() );
906-
907-
// vector< unsigned int >::iterator k = dep.begin();
894+
vector< unsigned int >::iterator k = dep.begin();
908895

909896
/// STL stuff follows, with the usual weirdness.
910897
vector<unsigned int>::iterator pos = unique( dep.begin(), dep.end() );

ksolve/Ksolve.cpp

Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,21 @@
1717
#include <gsl/gsl_odeiv2.h>
1818
#endif
1919

20-
#include "../shell/Shell.h"
21-
22-
#include "../mesh/MeshEntry.h"
23-
#include "../mesh/Boundary.h"
24-
#include "../mesh/ChemCompt.h"
25-
#include "../mesh/VoxelJunction.h"
26-
27-
#include "../utility/print_function.hpp"
28-
2920
#include "OdeSystem.h"
3021
#include "VoxelPoolsBase.h"
3122
#include "VoxelPools.h"
23+
#include "../mesh/VoxelJunction.h"
3224
#include "ZombiePoolInterface.h"
25+
3326
#include "RateTerm.h"
3427
#include "../basecode/SparseMatrix.h"
3528
#include "KinSparseMatrix.h"
3629
#include "Stoich.h"
30+
#include "../shell/Shell.h"
31+
32+
#include "../mesh/MeshEntry.h"
33+
#include "../mesh/Boundary.h"
34+
#include "../mesh/ChemCompt.h"
3735
#include "Ksolve.h"
3836

3937
#include <chrono>
@@ -246,15 +244,7 @@ Ksolve::Ksolve()
246244

247245
Ksolve::~Ksolve()
248246
{
249-
#if 0
250-
char* p = getenv( "MOOSE_SHOW_SOLVER_PERF" );
251-
if( p != NULL )
252-
{
253-
cout << "Info: Ksolve (+Dsolve) took " << totalTime_ << " seconds and took " << numSteps_
254-
<< " steps." << endl;
255-
256-
}
257-
#endif
247+
;
258248
}
259249

260250
//////////////////////////////////////////////////////////////
@@ -269,7 +259,6 @@ string Ksolve::getMethod() const
269259
void Ksolve::setMethod( string method )
270260
{
271261
std::transform(method.begin(), method.end(), method.begin(), ::tolower);
272-
273262
// If user is trying to set ksolve method after ksolve has been initialized,
274263
// show a warning.
275264
if( isBuilt_ )
@@ -288,44 +277,27 @@ void Ksolve::setMethod( string method )
288277
method_ = "rk5";
289278
}
290279
else if ( method == "rk4" || method == "rk2" ||
291-
method == "rk8" || method == "rkck" || method == "lsoda"
292-
)
280+
method == "rk8" || method == "rkck" || method == "lsoda" )
293281
{
294282
method_ = method;
295283
}
296284
else
297285
{
298286
cout << "Warning: Ksolve::setMethod: '" << method <<
299-
"' not known, using default rk5\n";
287+
"' is not known, using default rk5\n";
300288
method_ = "rk5";
301289
}
302290
#elif USE_BOOST_ODE
303291
// TODO: Check for boost related methods.
304292
method_ = method;
305293
#endif
306-
307294
}
308295

309296
double Ksolve::getEpsAbs() const
310297
{
311298
return epsAbs_;
312299
}
313300

314-
double Ksolve::getEpsRel() const
315-
{
316-
return epsRel_;
317-
}
318-
319-
double Ksolve::getRelativeAccuracy( ) const
320-
{
321-
return getEpsRel();
322-
}
323-
324-
double Ksolve::getAbsoluteAccuracy( ) const
325-
{
326-
return getEpsAbs();
327-
}
328-
329301
void Ksolve::setEpsAbs( double epsAbs )
330302
{
331303
if ( epsAbs < 0 )
@@ -334,6 +306,12 @@ void Ksolve::setEpsAbs( double epsAbs )
334306
epsAbs_ = epsAbs;
335307
}
336308

309+
310+
double Ksolve::getEpsRel() const
311+
{
312+
return epsRel_;
313+
}
314+
337315
void Ksolve::setEpsRel( double epsRel )
338316
{
339317
if ( epsRel < 0 )
@@ -537,8 +515,6 @@ double Ksolve::getEstimatedDt() const
537515
//////////////////////////////////////////////////////////////
538516
void Ksolve::process( const Eref& e, ProcPtr p )
539517
{
540-
541-
542518
if ( isBuilt_ == false )
543519
return;
544520

ksolve/OdeSystem.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616
#include <gsl/gsl_odeiv2.h>
1717
#endif /* ----- not USE_BOOST_ODE ----- */
1818

19-
class OdeSystem
20-
{
21-
public:
22-
OdeSystem()
23-
: method( "rk5" ),
24-
initStepSize( 0.001 ),
25-
epsAbs( 1e-6 ),
26-
epsRel( 1e-6 )
19+
class OdeSystem {
20+
public:
21+
OdeSystem()
22+
: method( "rk5" ),
23+
initStepSize( 0.001 ),
24+
epsAbs( 1e-6 ),
25+
epsRel( 1e-6 )
2726
{;}
2827

2928
std::string method;

0 commit comments

Comments
 (0)