Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
William Jones committed Sep 29, 2022
0 parents commit ce8b512
Show file tree
Hide file tree
Showing 88 changed files with 11,953 additions and 0 deletions.
117 changes: 117 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Delimiter: pb
Language: TextProto
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
...

7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
src/obj/*
src/all
src/out_test
src/out_*
src/Octave/*
*.vscode
build/*
10 changes: 10 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[submodule "lib/googletest"]
path = lib/googletest
url = https://github.com/google/googletest/
[submodule "lib/eigen"]
path = lib/eigen
url = https://gitlab.com/libeigen/eigen.git
branch = 3.4
[submodule "lib/cereal"]
path = lib/cereal
url = https://github.com/USCiLab/cereal.git
9 changes: 9 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This is the list of the Embecosm DCM (dcEmb)'s significant contributors.
#
# This does not necessarily list everyone who has contributed code,
# especially since many employees of one corporation may be contributing.
# To see the full list of contributors, see the revision history in
# source control.
Embecosm Limited
William Jones
Elliot Stein
142 changes: 142 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#
# Copyright (C) 2022 Embecosm Limited
#
# Contributor William Jones <[email protected]>
# Contributor Elliot Stein <[email protected]>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#

cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

project(dcm_demo LANGUAGES CXX)

add_subdirectory(${CMAKE_SOURCE_DIR}/lib/googletest)
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/eigen)
enable_testing()

include_directories(
${CMAKE_SOURCE_DIR}/lib/cereal/include
${CMAKE_SOURCE_DIR}/lib/eigen
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/include/COVID
${CMAKE_SOURCE_DIR}/include/3body
${CMAKE_SOURCE_DIR}/include/music
${CMAKE_SOURCE_DIR}/include/tests
${gtest_SOURCE_DIR}/include
${gtest_SOURCE_DIR}
)

set(SOURCES_COVID
src/dynamic_model.cc
src/generative_function.cc
src/feature_selection_function.cc
src/COVID/run_COVID_dcm.cc
src/COVID/DEM_COVID.cc
src/COVID/import_COVID.cc
src/COVID/dynamic_COVID_model.cc
src/COVID/generative_COVID.cc
src/COVID/feature_selection_COVID.cc
src/utility.cc
)

set(SOURCES_3BODY
src/dynamic_model.cc
src/generative_function.cc
src/feature_selection_function.cc
src/3body/run_3body_dcm.cc
src/3body/DEM_3body.cc
src/3body/dynamic_3body_model.cc
src/3body/generative_3body.cc
src/3body/feature_selection_3body.cc
src/utility.cc
)

set(SOURCES_MUSIC
src/dynamic_model.cc
src/generative_function.cc
src/music/run_music_dcm.cc
src/music/DEM_music.cc
src/music/dynamic_music_model.cc
src/music/generative_music.cc
src/utility.cc
)

set(SOURCES_TESTS
src/COVID/import_COVID.cc
tests/import_COVID_test.cc
src/feature_selection_function.cc
src/COVID/feature_selection_COVID.cc
tests/feature_selection_COVID_test.cc
src/generative_function.cc
src/COVID/generative_COVID.cc
tests/generative_COVID_test.cc
src/utility.cc
tests/utility_test.cc
src/dynamic_model.cc
src/generative_function.cc
src/feature_selection_function.cc
src/3body/dynamic_3body_model.cc
src/3body/generative_3body.cc
src/3body/feature_selection_3body.cc
tests/dynamic_3body_model_test.cc

)

set(SOURCES_SERIALIZATION_TESTS
src/dynamic_model.cc
src/generative_function.cc
src/feature_selection_function.cc
src/3body/dynamic_3body_model.cc
src/3body/generative_3body.cc
src/3body/feature_selection_3body.cc
src/COVID/import_COVID.cc
src/COVID/dynamic_COVID_model.cc
src/COVID/generative_COVID.cc
src/COVID/feature_selection_COVID.cc
src/utility.cc
tests/serialization_test.cc
)

set(SOURCES_TESTS_ELLIOT
src/COVID/import_COVID.cc
src/feature_selection_function.cc
src/COVID/feature_selection_COVID.cc
src/generative_function.cc
src/COVID/generative_COVID.cc
tests/generative_COVID_test.cc
src/utility.cc
src/dynamic_model.cc
src/generative_function.cc
src/log_likelihood_function.cc
src/feature_selection_function.cc
src/3body/dynamic_3body_model.cc
src/3body/generative_3body.cc
src/3body/log_likelihood_3body.cc
src/3body/feature_selection_3body.cc
)

find_package(OpenMP)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}-O3")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}-O3")

add_executable(dcm_covid ${SOURCES_COVID})
target_link_libraries(dcm_covid PUBLIC OpenMP::OpenMP_CXX)
set_target_properties(dcm_covid PROPERTIES LDFLAGS "-fopenmp -march=native -O3")
set_target_properties(dcm_covid PROPERTIES COMPILE_FLAGS "-fopenmp -lpthread -march=native -O3")

add_executable(dcm_3body ${SOURCES_3BODY})
target_link_libraries(dcm_3body PUBLIC OpenMP::OpenMP_CXX)
set_target_properties(dcm_3body PROPERTIES COMPILE_FLAGS "-g -fopenmp -lpthread -march=native -O3")

add_executable(run_tests ${SOURCES_TESTS})
target_link_libraries(run_tests PUBLIC gtest_main PUBLIC OpenMP::OpenMP_CXX)
set_target_properties(run_tests PROPERTIES COMPILE_FLAGS "-g -fopenmp -lpthread -march=native -O3")

add_executable(run_serialization_tests ${SOURCES_SERIALIZATION_TESTS})
target_link_libraries(run_serialization_tests PUBLIC gtest_main PUBLIC OpenMP::OpenMP_CXX PUBLIC)
set_target_properties(run_serialization_tests PROPERTIES COMPILE_FLAGS "-g -fopenmp -lpthread -march=native -O3")
9 changes: 9 additions & 0 deletions COPYING.BSD3
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
BSD 3-Clause License

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading

0 comments on commit ce8b512

Please sign in to comment.