-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniel Funke
committed
Feb 10, 2023
1 parent
b692a0d
commit 6f65753
Showing
58 changed files
with
12,152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Generated from CLion C/C++ Code Style settings | ||
BasedOnStyle: LLVM | ||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: None | ||
AlignOperands: Align | ||
AllowAllArgumentsOnNextLine: false | ||
AllowAllConstructorInitializersOnNextLine: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortBlocksOnASingleLine: Always | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: All | ||
AllowShortIfStatementsOnASingleLine: Always | ||
AllowShortLambdasOnASingleLine: All | ||
AllowShortLoopsOnASingleLine: true | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakTemplateDeclarations: Yes | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterCaseLabel: false | ||
AfterClass: false | ||
AfterControlStatement: Never | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterUnion: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: true | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializers: BeforeColon | ||
BreakInheritanceList: BeforeColon | ||
ColumnLimit: 0 | ||
CompactNamespaces: false | ||
ContinuationIndentWidth: 8 | ||
IndentCaseLabels: true | ||
IndentPPDirectives: None | ||
IndentWidth: 4 | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
MaxEmptyLinesToKeep: 2 | ||
NamespaceIndentation: All | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PointerAlignment: Right | ||
ReflowComments: false | ||
SpaceAfterCStyleCast: true | ||
SpaceAfterLogicalNot: false | ||
SpaceAfterTemplateKeyword: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 0 | ||
SpacesInAngles: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInContainerLiterals: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
TabWidth: 4 | ||
UseTab: Never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.idea | ||
cmake-build* | ||
build | ||
.DS_Store | ||
data | ||
data_bak | ||
benchmark | ||
__pycache__ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
project(GeoGraph) | ||
|
||
# default to Release building | ||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
message("Defaulting CMAKE_BUILD_TYPE to Release") | ||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type") | ||
endif () | ||
|
||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/") | ||
include_directories("${PROJECT_SOURCE_DIR}/include/") | ||
|
||
# set default for MARCH | ||
if (NOT MARCH) | ||
set(MARCH native CACHE STRING "ARCH to use") | ||
endif () | ||
|
||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSTIONS ON) | ||
|
||
set(CMAKE_C_STANDARD 11) | ||
set(CMAKE_C_STANDARD_REQUIRED ON) | ||
set(CMAKE_C_EXTENSTIONS ON) | ||
|
||
# setup modern c++ flags | ||
string(REPLACE "-O2" "-O3" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${MARCH} -pedantic -Wall -Wextra") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${MARCH} -pedantic -Wall -Wextra") | ||
|
||
add_executable(YaoGraph YaoGraph.cpp) | ||
add_executable(Generator Generator.cpp) | ||
|
||
option(WITH_CGAL "Build with CGAL for kernels and algorithms for comparision" OFF) | ||
if (WITH_CGAL) | ||
add_compile_definitions(WITH_CGAL) | ||
find_package(CGAL) | ||
include_directories(SYSTEM ${CGAL_INCLUDE_DIRS} ${INCLUDE_DIRECTORIES}) | ||
target_link_libraries(YaoGraph ${CGAL_LIBRARIES}) | ||
endif () | ||
|
||
option(WITH_CAIRO "Build with Cairo for drawing" OFF) | ||
if (WITH_CAIRO) | ||
add_compile_definitions(WITH_CAIRO) | ||
find_package(Cairomm REQUIRED) | ||
include_directories(SYSTEM "/usr/local/include" ${INCLUDE_DIRECTORIES}) | ||
include_directories(SYSTEM ${Cairomm_INCLUDE_DIRS} ${INCLUDE_DIRECTORIES}) | ||
target_link_libraries(YaoGraph ${Cairomm_LIBRARIES}) | ||
endif () | ||
|
||
if (CMAKE_BUILD_TYPE MATCHES Debug) | ||
message("debug mode - enable logging") | ||
add_compile_definitions(LOG_DEBUG) | ||
endif () | ||
|
||
option(WITH_VTUNE "Build for Profiling" OFF) | ||
if (WITH_VTUNE) | ||
add_compile_definitions(VTUNE) | ||
endif () | ||
|
||
option(WITH_STATS "Collect execution statistics" OFF) | ||
if (WITH_STATS) | ||
add_compile_definitions(WITH_STATS) | ||
endif () | ||
|
||
option(WITH_TESTS "Compile Tets" OFF) | ||
if (WITH_TESTS) | ||
find_package(GTest) | ||
if (GTEST_FOUND) | ||
add_subdirectory(test) | ||
endif () | ||
endif () | ||
|
||
set(ROAD_DIR "${PROJECT_SOURCE_DIR}/data" CACHE PATH "Path to road networks") | ||
add_compile_definitions(ROAD_DATA="${ROAD_DIR}") | ||
|
||
set(DATA_DIR "${PROJECT_SOURCE_DIR}/data" CACHE PATH "Path to graph data") | ||
add_compile_definitions(DATA_DIR="${DATA_DIR}") | ||
|
||
set(STAR_DIR "${PROJECT_SOURCE_DIR}/data" CACHE PATH "Path to gaia data") | ||
add_compile_definitions(STAR_DATA="${STAR_DIR}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#include <filesystem> | ||
#include <fstream> | ||
#include <iostream> | ||
|
||
#include "contrib/popl.hpp" | ||
|
||
#include "Utils/ASSERT.hpp" | ||
|
||
#include "Generators/Generators.hpp" | ||
#include "Types.hpp" | ||
|
||
// constants | ||
constexpr tBox BOUNDS{{0, 0}, | ||
{1, 1}}; | ||
constexpr tIndex minN = 1e3; | ||
constexpr tIndex maxN = 1e7; | ||
constexpr tDim Cones = 6; | ||
constexpr tIndex cellOcc = 1e2; | ||
constexpr tDim RepsPerI = 3; | ||
constexpr tDim RepsPerN = 3; | ||
|
||
const tIndex Seeds[] = {8158, 14030, 18545, 20099, 24065, 35700, 37197, 38132, 59135, 60315}; | ||
const char Dists[] = {'u', 'g', 'd', 'r', 's', 'c', 'b'}; | ||
|
||
void generate(GeneratorBase &gen, const tIndex &n, const tBox &iBounds) { | ||
|
||
std::cout << "Generating " << gen.name() << " with target " << n << " points and seed " << gen.seed() << ": " << std::flush; | ||
|
||
auto [points, oBounds] = gen.generate(n, iBounds); | ||
ASSERT(points.size() >= n); | ||
|
||
std::stringstream dir; | ||
dir << DATA_DIR << "/" << gen.name(); | ||
|
||
std::filesystem::path p(dir.str()); | ||
std::filesystem::create_directories(p); | ||
|
||
std::ofstream file(p.append("points_" + gen.name() + "_" + std::to_string(n) + "_" + std::to_string(gen.seed()) + ".csv"), std::ios::out | std::ios::trunc); | ||
|
||
// header | ||
file << "# n " << points.size() << std::endl; | ||
file << "# b " << oBounds.low[X] << " " << oBounds.low[Y] << " " << oBounds.high[X] << " " << oBounds.high[Y] << std::endl; | ||
|
||
for (auto &p : points) { | ||
file << p[X] << " " << p[Y] << std::endl; | ||
} | ||
|
||
std::cout << points.size() << " actually generated" << std::endl; | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
|
||
popl::OptionParser op("Point Generator"); | ||
auto sHelp = op.add<popl::Switch>("h", "help", "produce help message"); | ||
|
||
// generate points | ||
auto sAllDists = op.add<popl::Switch>("a", "all", "generate all available distributions"); | ||
auto oN = op.add<popl::Value<tIndex>>("n", "n", "number of points to generate"); | ||
auto oMinN = op.add<popl::Value<tIndex>>("", "minN", "minimum number of points to generate", minN); | ||
auto oMaxN = op.add<popl::Value<tIndex>>("", "maxN", "maxium number of points to generate", maxN); | ||
auto oSeed = op.add<popl::Value<tIndex>>("s", "seed", "seed for RNG", Seeds[0]); | ||
auto oInst = op.add<popl::Value<tIndex>>("i", "inst", "number of instances"); | ||
|
||
op.parse(argc, argv); | ||
|
||
if (sHelp->is_set()) { | ||
std::cout << op << "\n"; | ||
std::cout << "list of distributions to generate [_u_ni, _g_aussian, gri_d_, _r_oad, _s_tar, _c_ircle, _b_ubbles]" << std::endl; | ||
|
||
return 0; | ||
} | ||
|
||
std::vector<tIndex> seeds; | ||
if (oInst->is_set()) { | ||
// if oInst is set, oSeed is ignored | ||
for (uint i = 0; i < oInst->value(); ++i) { | ||
seeds.push_back(Seeds[i]); | ||
} | ||
} else { | ||
seeds.push_back(oSeed->value()); | ||
} | ||
|
||
std::vector<char> dists; | ||
if (sAllDists->is_set()) { | ||
for (auto d : Dists) { | ||
dists.push_back(d); | ||
} | ||
} else if (op.non_option_args().size()) { | ||
for (uint i = 0; i < op.non_option_args().size(); ++i) { | ||
dists.push_back(op.non_option_args()[i][0]); | ||
} | ||
} else { | ||
std::cout << "Distribution must be specified" << std::endl; | ||
} | ||
|
||
if (oN->is_set()) { | ||
oMinN->set_value(oN->value()); | ||
oMaxN->set_value(oN->value()); | ||
} | ||
|
||
for (auto g : dists) { | ||
auto gen = getGen(g, 0); | ||
|
||
if (!gen) { | ||
std::cout << "Invalid distribution specified: " << g << std::endl; | ||
continue; | ||
} | ||
|
||
for (auto s : seeds) { | ||
for (tIndex nPoints = oMinN->value(); nPoints <= oMaxN->value(); nPoints += 3 * pow(10, floor(log10(nPoints)))) { | ||
gen->setSeed(s); | ||
generate(*gen, nPoints, BOUNDS); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Daniel Funke | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.