Skip to content

Commit 9e7ac66

Browse files
committed
Refactored file structure
1 parent 07c39df commit 9e7ac66

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1697
-1303
lines changed

.clang-format

Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
# Docs:
2+
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
3+
4+
# The style used for all options not specifically set in the configuration.
5+
# Available options: LLVM, Google, Chromium, Mozilla, WebKit
6+
BasedOnStyle: Google
7+
8+
# The extra indent or outdent of access modifiers, e.g. public:.
9+
AccessModifierOffset: -4
10+
11+
# If true, horizontally aligns arguments after an open bracket.
12+
# This applies to round brackets (parentheses), angle brackets and square brackets. This will result in formattings like code someLongFunction(argument1, argument2); endcode
13+
AlignAfterOpenBracket: AlwaysBreak
14+
15+
# If true, aligns escaped newlines as far left as possible. Otherwise puts them into the right-most column.
16+
AlignEscapedNewlinesLeft: Left
17+
18+
# If true, horizontally align operands of binary and ternary expressions.
19+
AlignOperands: true
20+
21+
# If true, aligns trailing comments.
22+
AlignTrailingComments: false
23+
24+
# If a function call or braced initializer list doesn’t fit on a line, allow putting all arguments onto the next line, even if BinPackArguments is false.
25+
AllowAllArgumentsOnNextLine: false
26+
27+
# Allow putting all parameters of a function declaration onto the next line even if BinPackParameters is false.
28+
AllowAllParametersOfDeclarationOnNextLine: false
29+
30+
# Allows contracting simple braced statements to a single line.
31+
# E.g., this allows if (a) { return; } to be put on a single line.
32+
# Shayan: I set it to false. I think if you want to create a single line block,
33+
# might as well just not create the block in the first place.
34+
AllowShortBlocksOnASingleLine: false
35+
36+
# If true, short case labels will be contracted to a single line.
37+
AllowShortCaseLabelsOnASingleLine: true
38+
39+
# Dependent on the value, int f() { return 0; } can be put on a single line.
40+
# SFS_None (in configuration: None) Never merge functions into a single line.
41+
# SFS_Inline (in configuration: Inline) Only merge functions defined inside a class.
42+
# SFS_Empty (in configuration: Empty) Only merge empty functions.
43+
# SFS_All (in configuration: All) Merge all functions fitting on a single line.
44+
AllowShortFunctionsOnASingleLine: Inline
45+
46+
# If true, if (a) return; can be put on a single line.
47+
# if( condition ) do something; -> YES
48+
# if( condition )
49+
# do something; -> DON'T
50+
AllowShortIfStatementsOnASingleLine: true
51+
52+
# Dependent on the value, auto lambda []() { return 0; } can be put on a single line.
53+
AllowShortLambdasOnASingleLine: All
54+
55+
# If true, while (true) continue; can be put on a single line.
56+
# while( condition ) do something; -> YES
57+
# while( condition )
58+
# do something; -> DON'T
59+
AllowShortLoopsOnASingleLine: true
60+
61+
# The function definition return type breaking style to use. This option is deprecated and is
62+
# retained for backwards compatibility.
63+
# AlwaysBreakAfterDefinitionReturnType: false
64+
65+
# If true, always break before multiline string literals.
66+
AlwaysBreakBeforeMultilineStrings: false
67+
68+
# If true, always break after the template<...> of a template declaration.
69+
AlwaysBreakTemplateDeclarations: true
70+
71+
# If false, a function call's arguments will either be all on the same line or will have one line each.
72+
BinPackArguments: false
73+
74+
# If false, a function call's arguments will either be all
75+
# on the same line or will have one line each.
76+
BinPackParameters: false
77+
78+
# The way to wrap binary operators.
79+
# BOS_None (in configuration: None) Break after operators.
80+
# BOS_NonAssignment (in configuration: NonAssignment) Break before operators that aren't assignments.
81+
# BOS_All (in configuration: All) Break before operators.
82+
#BreakBeforeBinaryOperators: None
83+
84+
# The brace breaking style to use.
85+
# BS_Attach (in configuration: Attach) Always attach braces to surrounding context.
86+
# BS_Linux (in configuration: Linux) Like Attach, but break before braces on function, namespace and class definitions.
87+
# BS_Stroustrup (in configuration: Stroustrup) Like Attach, but break before function definitions, and `else`.
88+
# BS_Allman (in configuration: Allman) Always break before braces.
89+
# BS_GNU (in configuration: GNU) Always break before braces and add an extra level of indentation to braces of control statements, not to those of class, function or other definitions.
90+
BraceWrapping:
91+
AfterClass: true
92+
AfterControlStatement: false
93+
AfterEnum: false
94+
AfterFunction: true
95+
AfterNamespace: false
96+
AfterObjCDeclaration: false
97+
AfterStruct: true
98+
AfterUnion: false
99+
BeforeCatch: false
100+
BeforeElse: false
101+
IndentBraces: false
102+
SplitEmptyFunction: false
103+
BreakBeforeBraces: Custom
104+
105+
# If true, ternary operators will be placed after line breaks.
106+
BreakBeforeTernaryOperators: true
107+
108+
# Always break constructor initializers before commas and align the commas with the colon.
109+
BreakConstructorInitializersBeforeComma: true
110+
111+
# The column limit.
112+
# A column limit of 0 means that there is no column limit. In this case, clang-format will respect the input's line breaking decisions within statements unless they contradict other rules.
113+
ColumnLimit: 100
114+
115+
# A regular expression that describes comments with special meaning, which should not be split into lines or otherwise changed.
116+
CommentPragmas: "\/*(.*)*\/"
117+
118+
# If the constructor initializers don't fit on a line, put each initializer on its own line.
119+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
120+
121+
# The number of characters to use for indentation of constructor initializer lists.
122+
ConstructorInitializerIndentWidth: 4
123+
124+
# Indent width for line continuations.
125+
# A little more than normal indent
126+
ContinuationIndentWidth: 4
127+
128+
# If true, format braced lists as best suited for C++11 braced lists.
129+
# Important differences: - No spaces inside the braced list. - No line break before the closing brace. - Indentation with the continuation indent, not with the block indent.
130+
# Fundamentally, C++11 braced lists are formatted exactly like function calls would be formatted in their place. If the braced list follows a name (e.g. a type or variable name), clang-format formats as if the {} were the parentheses of a function call with that name. If there is no name, a zero-length name is assumed.
131+
Cpp11BracedListStyle: true
132+
133+
# If true, analyze the formatted file for the most common alignment of & and *. Point
134+
DerivePointerAlignment: false
135+
136+
# Disables formatting at all.
137+
#DisableFormat: false
138+
139+
# If true, clang-format detects whether function calls and definitions are formatted with one parameter per line.
140+
# Each call can be bin-packed, one-per-line or inconclusive. If it is inconclusive, e.g. completely on one line, but a decision needs to be made, clang-format analyzes whether there are other bin-packed cases in the input file and act accordingly.
141+
# NOTE: This is an experimental flag, that might go away or be renamed. Do not use this in config files, etc. Use at your own risk.
142+
#ExperimentalAutoDetectBinPacking: false
143+
144+
# If true, clang-format adds missing namespace end comments and fixes invalid existing ones.
145+
FixNamespaceComments: true
146+
147+
# A vector of macros that should be interpreted as foreach loops instead of as function calls.
148+
# These are expected to be macros of the form: code FOREACH(<variable-declaration>, ...) <loop-body> endcode
149+
# For example: BOOST_FOREACH.
150+
#ForEachMacros (std::vector<std::string>)
151+
152+
# Dependent on the value, multiple #include blocks can be sorted as one and divided based on category.
153+
IncludeBlocks: Preserve
154+
155+
# Indent case labels one level from the switch statement.
156+
# When false, use the same indentation level as for the switch statement. Switch statement body is always indented one level more than case labels.
157+
IndentCaseLabels: false
158+
159+
# The number of columns to use for indentation.
160+
IndentWidth: 4
161+
162+
# Indent if a function definition or declaration is wrapped after the type.
163+
#IndentWrappedFunctionNames: false
164+
165+
# If true, empty lines at the start of blocks are kept.
166+
#KeepEmptyLinesAtTheStartOfBlocks: false
167+
168+
# Language, this format style is targeted at.
169+
# LK_None (in configuration: None) Do not use.
170+
# LK_Cpp (in configuration: Cpp) Should be used for C, C++, ObjectiveC, ObjectiveC++.
171+
# LK_Java (in configuration: Java) Should be used for Java.
172+
# LK_JavaScript (in configuration: JavaScript) Should be used for JavaScript.
173+
# LK_Proto (in configuration: Proto) Should be used for Protocol Buffers (https://developers.google.com/protocol-buffers/).
174+
Language: Cpp
175+
176+
# The maximum number of consecutive empty lines to keep.
177+
MaxEmptyLinesToKeep: 2
178+
179+
# The indentation used for namespaces.
180+
# NI_None (in configuration: None) Don't indent in namespaces.
181+
# NI_Inner (in configuration: Inner) Indent only in inner namespaces (nested in other namespaces).
182+
# NI_All (in configuration: All) Indent in all namespaces.
183+
NamespaceIndentation: None
184+
185+
# The number of characters to use for indentation of ObjC blocks.
186+
#ObjCBlockIndentWidth: 4
187+
188+
# Add a space after @property in Objective-C, i.e. use \@property (readonly) instead of \@property(readonly).
189+
#ObjCSpaceAfterProperty: false
190+
191+
# Add a space in front of an Objective-C protocol list, i.e. use Foo <Protocol> instead of Foo<Protocol>.
192+
#ObjCSpaceBeforeProtocolList: false
193+
194+
# The penalty for breaking a function call after `call(`.
195+
#PenaltyBreakBeforeFirstCallParameter (unsigned)
196+
197+
# The penalty for each line break introduced inside a comment.
198+
#PenaltyBreakComment (unsigned)
199+
200+
# The penalty for breaking before the first <<.
201+
#PenaltyBreakFirstLessLess (unsigned)
202+
203+
# The penalty for each line break introduced inside a string literal.
204+
#PenaltyBreakString (unsigned)
205+
206+
# The penalty for each character outside of the column limit.
207+
#PenaltyExcessCharacter (unsigned)
208+
209+
# Penalty for putting the return type of a function onto its own line.
210+
#PenaltyReturnTypeOnItsOwnLine (unsigned)
211+
212+
# Pointer and reference alignment style.
213+
PointerAlignment: Left
214+
215+
# If true, clang-format will attempt to re-flow comments.
216+
ReflowComments: true
217+
218+
# Add a space before parentheses
219+
# if (condition) -> tick
220+
# if(condition) -> cross
221+
SpaceBeforeParens: ControlStatements
222+
223+
# If true, a space may be inserted after C style casts.
224+
SpaceAfterCStyleCast: false
225+
226+
# If false, spaces will be removed before assignment operators.
227+
#SpaceBeforeAssignmentOperators: true
228+
229+
# If true, spaces may be inserted into `()`.
230+
SpaceInEmptyParentheses: false
231+
232+
# The number of spaces before trailing line comments (// - comments).
233+
# This does not affect trailing block comments (/**/ - comments) as those commonly have different usage patterns and a number of special cases.
234+
SpacesBeforeTrailingComments: 1
235+
236+
# If true, spaces will be inserted after `<` and before `>` in template argument lists
237+
SpacesInAngles: false
238+
239+
# If true, spaces may be inserted into C style casts.
240+
SpacesInCStyleCastParentheses: false
241+
242+
# If true, spaces are inserted inside container literals (e.g. ObjC and Javascript array and dict literals).
243+
SpacesInContainerLiterals: false
244+
245+
# If true, spaces will be inserted after `(` and before `)`.
246+
SpacesInParentheses: false
247+
248+
# If true, spaces will be inserted after `[` and before `]`.
249+
SpacesInSquareBrackets: false
250+
251+
# Format compatible with this standard, e.g. use A<A<int> > instead of A<A<int>> for LS_Cpp03.
252+
# LS_Cpp03 (in configuration: Cpp03) Use C++03-compatible syntax.
253+
# LS_Cpp11 (in configuration: Cpp11) Use features of C++11 (e.g. A<A<int>> instead of A<A<int> >).
254+
# LS_Auto (in configuration: Auto) Automatic detection based on the input.
255+
Standard: Cpp11
256+
257+
# The number of columns used for tab stops.
258+
TabWidth: 4
259+
260+
# The way to use tab characters in the resulting file.
261+
# UT_Never (in configuration: Never) Never use tab.
262+
# UT_ForIndentation (in configuration: ForIndentation) Use tabs only for indentation.
263+
# UT_Always (in configuration: Always) Use tabs whenever we need to fill whitespace that spans at least from one tab stop to the next one.
264+
UseTab: Never

CMakeLists.txt

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.25)
2-
project(CurvatureMetric)
2+
project(PennerOptimization)
33

44
set(CMAKE_CXX_STANDARD 17)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -8,8 +8,6 @@ add_compile_options(-fPIC)
88
set(DIR_EXT "${CMAKE_CURRENT_SOURCE_DIR}/ext")
99

1010
if (PROJECT_IS_TOP_LEVEL)
11-
message("Curvature Metric is top level project")
12-
1311
# Options for the project
1412
option(USE_PYBIND "Generate pybindings" ON)
1513
option(USE_MULTIPRECISION "Use high precision floating point" OFF)
@@ -99,54 +97,50 @@ if(ENABLE_VISUALIZATION)
9997
add_compile_definitions(ENABLE_VISUALIZATION)
10098
endif()
10199

102-
# Make main cpp library
103-
add_subdirectory(src/optimization)
104-
105100
if(ENABLE_VISUALIZATION)
106101
include(polyscope)
107-
target_link_libraries(MetricOptimizationLib PRIVATE
102+
set(POLYSCOPE_LIBRARIES
108103
polyscope
109104
)
110105
endif()
111106

107+
# Make main cpp library
108+
add_subdirectory(src)
112109

113-
# Build pybind optimization functions
114-
message("FIXME Building pybind libraries")
115110

111+
if(USE_SUITESPARSE)
112+
include(suitesparse)
113+
target_link_libraries(PennerOptimizationLib PRIVATE
114+
SuiteSparse::SuiteSparseConfig
115+
SuiteSparse::CHOLMOD
116+
)
117+
endif()
118+
119+
# Build pybind optimization functions
116120
if(USE_PYBIND)
117-
message("Building pybind libraries")
118121
include(pybind11)
119122
add_library(optimization_py MODULE
120-
src/optimization/optimization_pybind.cpp
123+
src/penner_optimization_pybind.cpp
121124
)
122125

126+
# Link libraries
127+
target_link_libraries(optimization_py PUBLIC
128+
PennerOptimizationLib
129+
pybind11::module
130+
)
123131
# Link visualization methods if created
124132
if(RENDER_TEXTURE)
125133
add_compile_definitions(RENDER_TEXTURE)
126134
target_link_libraries(optimization_py PRIVATE
127135
visualization
128136
)
129137
endif()
130-
131-
# Link libraries
132-
target_link_libraries(optimization_py PUBLIC
133-
MetricOptimizationLib
134-
)
135-
136138
if(USE_HIGHFIVE)
137139
target_link_libraries(optimization_py PUBLIC
138140
HighFiveLib
139141
)
140142
endif()
141143

142-
if(USE_SUITESPARSE)
143-
include(suitesparse)
144-
target_link_libraries(MetricOptimizationLib PRIVATE
145-
SuiteSparse::SuiteSparseConfig
146-
SuiteSparse::CHOLMOD
147-
)
148-
endif()
149-
150144
# Set pybinding settings
151145
set_target_properties(optimization_py PROPERTIES LIBRARY_OUTPUT_DIRECTORY
152146
${PROJECT_SOURCE_DIR}/py
@@ -170,7 +164,7 @@ if(NOT USE_MULTIPRECISION)
170164
#add_library(CurvatureMetricTestsLib
171165
#)
172166
#target_link_libraries(CurvatureMetricTestsLib PUBLIC
173-
# MetricOptimizationLib
167+
# PennerOptimizationLib
174168
# Catch2::Catch2WithMain
175169
#)
176170

@@ -179,7 +173,7 @@ if(NOT USE_MULTIPRECISION)
179173
src/tests/tests.cpp
180174
)
181175
target_link_libraries(CurvatureMetricTests PRIVATE
182-
MetricOptimizationLib
176+
PennerOptimizationLib
183177
Catch2::Catch2WithMain
184178
)
185179
set(TEST_DATA_ROOT "${PROJECT_SOURCE_DIR}/src/tests/regression/")

py/.DS_Store

0 Bytes
Binary file not shown.

src/.DS_Store

-4 KB
Binary file not shown.

src/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
add_subdirectory(core)
2+
add_subdirectory(metric_optimization)
3+
add_subdirectory(parameterization)
4+
add_subdirectory(util)
5+
6+
add_library(PennerOptimizationLib
7+
penner_optimization_interface.cpp
8+
)
9+
target_include_directories(PennerOptimizationLib PUBLIC .)
10+
target_link_libraries(PennerOptimizationLib PUBLIC
11+
PennerOptimizationCoreLib
12+
MetricOptimizationLib
13+
ParameterizationLib
14+
PennerOptimizationUtilLib
15+
)
16+
target_compile_definitions(PennerOptimizationLib PUBLIC
17+
SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG
18+
)
19+
target_compile_options(PennerOptimizationLib PRIVATE
20+
-Wall -Wpedantic -Wextra -Werror
21+
)

0 commit comments

Comments
 (0)