Skip to content

Commit 4b256af

Browse files
committed
Reformat code
1 parent c310f53 commit 4b256af

File tree

3 files changed

+152
-169
lines changed

3 files changed

+152
-169
lines changed

include/marco/Runtime/Solvers/IDA/Instance.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ using ResidualFunction = double (*)(double, const int64_t *);
3232
/// The 6th argument is a pointer to the list of AD seed identifiers
3333
/// The result is the Jacobian value.
3434
using JacobianFunction = double (*)(double, const int64_t *, const uint64_t *,
35-
double, uint64_t, const uint64_t*);
35+
double, uint64_t, const uint64_t *);
3636

3737
/// A descriptor of a Jacobian function is a pair of value consisting in:
3838
/// - the function pointer
3939
/// - the number of elements of each AD seed
40-
using JacobianFunctionDescriptor = std::pair<JacobianFunction, std::vector<uint64_t>>;
40+
using JacobianFunctionDescriptor =
41+
std::pair<JacobianFunction, std::vector<uint64_t>>;
4142

4243
/// A map indicating the IDs of the buffers living inside the memory pool to
4344
/// be used as AD seeds for each Jacobian function.
@@ -51,8 +52,8 @@ using JacobianSeedsMap = std::map<JacobianFunction, std::vector<uint64_t>>;
5152
/// - the end indices (excluded)
5253
/// - the map indicating the buffer IDs to be used when computing the
5354
/// partial derivatives
54-
using ThreadEquationsChunk =
55-
std::tuple<Equation, std::vector<int64_t>, std::vector<int64_t>, JacobianSeedsMap>;
55+
using ThreadEquationsChunk = std::tuple<Equation, std::vector<int64_t>,
56+
std::vector<int64_t>, JacobianSeedsMap>;
5657

5758
class IDAInstance {
5859
public:
@@ -94,7 +95,7 @@ class IDAInstance {
9495
/// equation.
9596
void addJacobianFunction(Equation equationIndex, Variable variableIndex,
9697
JacobianFunction jacobianFunction,
97-
uint64_t numOfSeeds, uint64_t* seedSizes);
98+
uint64_t numOfSeeds, uint64_t *seedSizes);
9899

99100
/// Instantiate and initialize all the classes needed by IDA in order to
100101
/// solve the given system of equations. It also sets optional simulation
@@ -162,7 +163,9 @@ class IDAInstance {
162163

163164
[[nodiscard]] uint64_t getVariableRank(Variable variable) const;
164165

165-
void iterateAccessedArrayVariables(Equation equation, std::function<void(Variable)> callback) const;
166+
void
167+
iterateAccessedArrayVariables(Equation equation,
168+
std::function<void(Variable)> callback) const;
166169

167170
std::vector<JacobianColumn>
168171
computeJacobianColumns(Equation eq, const int64_t *equationIndices) const;
@@ -180,7 +183,7 @@ class IDAInstance {
180183
void equationsParallelIteration(
181184
std::function<void(Equation equation,
182185
const std::vector<int64_t> &equationIndices,
183-
const JacobianSeedsMap& jacobianSeedsMap)>
186+
const JacobianSeedsMap &jacobianSeedsMap)>
184187
processFn);
185188

186189
void getVariableBeginIndices(Variable variable,

include/marco/Runtime/Support/MemoryManagement.h

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,61 +7,60 @@
77
#include <memory>
88
#include <vector>
99

10-
extern "C"
11-
{
12-
void* marco_malloc(int64_t size);
13-
void* marco_realloc(void* ptr, int64_t size);
14-
void marco_free(void* ptr);
10+
extern "C" {
11+
void *marco_malloc(int64_t size);
12+
void *marco_realloc(void *ptr, int64_t size);
13+
void marco_free(void *ptr);
1514
};
1615

1716
namespace marco::runtime {
1817
class MemoryPool {
1918
public:
2019
MemoryPool() = default;
2120

22-
MemoryPool(const MemoryPool& other) = delete;
21+
MemoryPool(const MemoryPool &other) = delete;
2322

24-
MemoryPool(MemoryPool&& other) = default;
23+
MemoryPool(MemoryPool &&other) = default;
2524

2625
~MemoryPool();
2726

28-
MemoryPool& operator=(const MemoryPool& other) = delete;
27+
MemoryPool &operator=(const MemoryPool &other) = delete;
2928

30-
MemoryPool& operator=(MemoryPool&& other) = default;
29+
MemoryPool &operator=(MemoryPool &&other) = default;
3130

32-
double* get(uint64_t id) const;
31+
double *get(uint64_t id) const;
3332

3433
uint64_t create(size_t numOfElements);
3534

3635
private:
37-
std::vector<double*> buffers;
36+
std::vector<double *> buffers;
3837
};
3938

4039
class MemoryPoolManager {
4140
private:
4241
MemoryPoolManager() = default;
4342

4443
public:
45-
static MemoryPoolManager& getInstance();
44+
static MemoryPoolManager &getInstance();
4645

47-
MemoryPoolManager(const MemoryPoolManager& other) = delete;
46+
MemoryPoolManager(const MemoryPoolManager &other) = delete;
4847

49-
MemoryPoolManager(MemoryPoolManager&& other) = default;
48+
MemoryPoolManager(MemoryPoolManager &&other) = default;
5049

5150
~MemoryPoolManager() = default;
5251

53-
MemoryPoolManager& operator=(const MemoryPoolManager& other) = delete;
52+
MemoryPoolManager &operator=(const MemoryPoolManager &other) = delete;
5453

55-
MemoryPoolManager& operator=(MemoryPoolManager&& other) = default;
54+
MemoryPoolManager &operator=(MemoryPoolManager &&other) = default;
5655

57-
MemoryPool& get(uint64_t pool) const;
56+
MemoryPool &get(uint64_t pool) const;
5857

5958
uint64_t create();
6059

6160
private:
6261
std::vector<std::unique_ptr<MemoryPool>> pools{};
6362
};
64-
}
63+
} // namespace marco::runtime
6564

6665
RUNTIME_FUNC_DECL(memoryPoolGet, PTR(void), int64_t, int64_t)
6766

0 commit comments

Comments
 (0)