-
Notifications
You must be signed in to change notification settings - Fork 19
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
Showing
3,559 changed files
with
1,175,569 additions
and
3,719 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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,5 @@ | ||
/** | ||
!/CMakeLists.txt | ||
!/src | ||
!/thirdparty | ||
!/docker |
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,29 @@ | ||
name: Bump Homebrew formula | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
homebrew: | ||
name: Bump Homebrew formula | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get the version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | ||
|
||
- name: Update homebrew tap | ||
uses: mislav/[email protected] | ||
with: | ||
formula-name: city4cfd | ||
formula-path: Formula/city4cfd.rb | ||
homebrew-tap: tudelft3d/homebrew-software | ||
base-branch: main | ||
download-url: https://github.com/tudelft3d/city4cfd/archive/${{ steps.get_version.outputs.VERSION }}.tar.gz | ||
commit-message: | | ||
Bumped {{formulaName}} to {{version}} | ||
Created by https://github.com/mislav/bump-homebrew-formula-action | ||
env: | ||
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }} |
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
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,4 @@ | ||
# Changelog | ||
|
||
## [0.1.0] - 2022-08-14 | ||
First release |
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 @@ | ||
@article{Paden2022, | ||
author={Paden, Ivan, Garc{\'i}a-S{\'a}nchez Clara and Ledoux, Hugo}, | ||
title={Towards Automatic Reconstruction of 3D City Models Tailored for Urban Flow Simulations}, | ||
journal={Frontiers in Built Environment}, | ||
volume={8}, | ||
year={2022}, | ||
doi={10.3389/fbuil.2022.899332}, | ||
ISSN={2297-3362}, | ||
} |
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 |
---|---|---|
@@ -1,39 +1,67 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
|
||
project(City4CFD) | ||
project(city4cfd) | ||
|
||
#set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH}) | ||
#set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true ) | ||
|
||
set( CMAKE_CXX_FLAGS "-O3" ) | ||
set( CMAKE_BUILD_TYPE "Release" ) | ||
#set( CMAKE_BUILD_TYPE "Debug" ) | ||
set(CMAKE_CXX_FLAGS "-O3") | ||
set(CMAKE_BUILD_TYPE "Release") | ||
#set(CMAKE_BUILD_TYPE "Debug") | ||
|
||
#if ( COMMAND cmake_policy ) | ||
# cmake_policy( SET CMP0003 NEW ) | ||
#if (COMMAND cmake_policy) | ||
# cmake_policy(SET CMP0003 NEW) | ||
#endif() | ||
|
||
#============================== | ||
# Alpha wrap support | ||
set(ALPHA_WRAP_SUPPORT OFF) | ||
#============================== | ||
|
||
# BOOST | ||
find_package( Boost REQUIRED COMPONENTS filesystem) | ||
find_package(Boost 1.66 REQUIRED COMPONENTS filesystem) | ||
|
||
# CGAL | ||
find_package( CGAL REQUIRED QUIET COMPONENTS) | ||
|
||
# LAStools | ||
add_subdirectory( ${CMAKE_SOURCE_DIR}/thirdparty/LAStools ) | ||
find_package(CGAL REQUIRED QUIET COMPONENTS) | ||
if (CGAL_FOUND) | ||
if (CGAL_VERSION VERSION_GREATER_EQUAL "5.3") | ||
message(STATUS "Found CGAL ${CGAL_VERSION}") | ||
elseif (CGAL_VERSION VERSION_GREATER_EQUAL "5.0") | ||
message(STATUS "Found CGAL version greater than 5.0, but less than 5.3. " | ||
"Proceeding to compile with included CGAL headers.") | ||
include_directories(${CMAKE_SOURCE_DIR}/thirdparty/CGAL/include) | ||
set(CGAL_USE_INCLUDED_HEADERS ON) | ||
else() | ||
message(FATAL_ERROR "Found CGAL version ${CGAL_VERSION} which is not supported!" | ||
"Please use CGAL version 5") | ||
return() | ||
endif () | ||
endif () | ||
if (NOT CGAL_USE_INCLUDED_HEADERS AND ALPHA_WRAP_SUPPORT) | ||
message(STATUS "Requested alpha wrap support. Compiling with included CGAL headers.") | ||
include_directories( ${CMAKE_SOURCE_DIR}/thirdparty/CGAL/include ) | ||
endif() | ||
|
||
# Third-party | ||
include_directories( ${CMAKE_SOURCE_DIR}/thirdparty ) | ||
include_directories( ${CMAKE_SOURCE_DIR}/thirdparty/valijson ) | ||
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/LAStools) | ||
include_directories(${CMAKE_SOURCE_DIR}/thirdparty) | ||
include_directories(${CMAKE_SOURCE_DIR}/thirdparty/valijson) | ||
include_directories(${Boost_INCLUDE_DIR}) | ||
|
||
# Creating entries for target: City4CFD | ||
FILE(GLOB SRC_FILES "src/*.cpp") | ||
add_executable(City4CFD ${SRC_FILES}) | ||
add_executable(city4cfd ${SRC_FILES}) | ||
set_target_properties( | ||
City4CFD | ||
city4cfd | ||
PROPERTIES CXX_STANDARD 14 | ||
) | ||
|
||
target_link_libraries( City4CFD ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} Boost::filesystem) | ||
target_link_libraries(city4cfd | ||
${CGAL_LIBRARIES} | ||
${CGAL_3RD_PARTY_LIBRARIES} | ||
${Boost_SYSTEM_LIBRARY} | ||
${Boost_FILESYSTEM_LIBRARY} | ||
LASlib | ||
) | ||
|
||
install(TARGETS City4CFD DESTINATION bin) | ||
install(TARGETS city4cfd DESTINATION bin) |
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 |
---|---|---|
@@ -1 +1,96 @@ | ||
[![docs](https://img.shields.io/badge/docs-Wiki-brightgreen)](https://github.com/tudelft3d/City4CFD/wiki) | ||
[![GitHub license](https://img.shields.io/github/license/tudelft3d/City4CFD)](https://github.com/tudelft3d/City4CFD/blob/master/LICENSE) | ||
[![DOI:10.3389/fbuil.2022.899332](http://img.shields.io/badge/DOI-10.3389/fbuil.2022.899332-B62030.svg)](https://www.frontiersin.org/articles/10.3389/fbuil.2022.899332) | ||
|
||
|
||
# City4CFD | ||
|
||
![welcome_figure](https://github.com/tudelft3d/City4CFD/blob/main/docs/images/workflow.png) | ||
|
||
City4CFD--*City for CFD*--is a tool that aims to automatically reconstruct 3D city geometries tailored for microscale urban flow simulations. | ||
|
||
It can create automatically a terrain from a point cloud and imprint different surfaces (e.g. green areas, water, roads). | ||
|
||
It enables us to reconstruct buildings from different sources and their combination, such as: | ||
- Reconstruction with the combination of 2D polygons and a point cloud, | ||
- Extrusion of footprints containing height or floor number attributes, | ||
- The import of existing building models. | ||
|
||
The resulting geometry is watertight -- buildings and surfaces are seamlessly integrated into a terrain. | ||
|
||
It can automatically or manually define the zone of influence and domain boundaries. | ||
|
||
If you happen to use it, feedback is very much appreciated. | ||
|
||
City4CFD is developed by the [3D Geoinformation Research Group](https://3d.bk.tudelft.nl/) at the Delft University of Technology. | ||
|
||
## Data formats | ||
**Point clouds** can be imported in LAS/LAZ, XYZ, or PLY format. We ask separately for ground and building points. While some datasets contain building-ground classification, some do not. In case your LAS/LAZ file has buildings/ground classified, you can use [point cloud preparation script](https://github.com/tudelft3d/City4CFD/blob/main/tools/prepare_point_cloud.sh) to create separate files. If buildings and terrain are under the same class, or vegetation is not filtered out, we suggest you use [CloudCompare](https://www.danielgm.net/cc/) to prepare points. | ||
|
||
**2D data** (polygons) are imported in GeoJSON format. For all pre-processing related to polygons, including conversion to GeoJSON, you can use [QGIS](https://qgis.org/en/site/). | ||
|
||
**Geometry import** supports the following formats: OBJ, STL, PLY, OFF, VTP, and CityJSON. | ||
|
||
**Output** is in the following formats: OBJ, STL, and CityJSON. The ID of each polygon is preserved, and there is a 1-to-1 mapping between the input and the output. | ||
|
||
## Installation | ||
You can directly compile City4CFD on your system using cmake, run it through a Docker container, or install using Homebrew in case of macOS. | ||
|
||
### Build from source | ||
The following libraries are required to build the project: | ||
- [CGAL](https://www.cgal.org/) version 5 | ||
- Boost >= 1.66 | ||
|
||
Both dependencies are generally available in Linux distributions (Debian/Ubuntu/Mint) as *libcgal-dev* and *libboost-dev*, and in macOS with Homebrew as *cgal* and *boost*. | ||
The project uses CMake to generate makefiles, so make sure it is also installed. | ||
|
||
To build City4CFD, do the following: | ||
``` | ||
mkdir build && cd build | ||
cmake .. | ||
make | ||
./city4cfd | ||
``` | ||
You can speed up compilation by typing *make -j $numcores* where *$numcores* is the number of threads you can spare for compilation. | ||
|
||
### Docker | ||
We offer built [Docker](https://www.docker.com/) images for every release, available at the [Docker Hub](https://hub.docker.com/r/tudelft3d/city4cfd). Running the docker script for the first time will pull the docker image from the Docker Hub repository. | ||
|
||
### macOS | ||
Mac users can install City4CFD through Homebrew: | ||
|
||
``` | ||
brew tap tudelft3d/software | ||
brew install city4cfd | ||
``` | ||
|
||
## Getting started | ||
|
||
The folder *examples* contains example datasets you can run for your first reconstruction. You can run your first reconstruction from the `/examples/TUD_Campus` folder by typing: | ||
``` | ||
mkdir results | ||
../../build/city4cfd config_bpg.json --output_dir results | ||
``` | ||
in case of building from a source. | ||
|
||
To run through a Docker container, you can use one of the scripts in ```docker/run/```. The script with the extension ```.sh``` can be used in Linux and macOS, the one with the extension ```.ps1``` in Windows Powershell, and the last one with ```.bat``` in Windows Command Prompt. You have to run a script (you can copy it beforehand) from the root directory of the project (e.g. ```examples/TUD_Campus```), and the arguments are the same as for the compiled executable, e.g.: | ||
|
||
``` | ||
../../docker/run/city4cfd_run.sh config_bpg.json --output_dir results | ||
``` | ||
|
||
The script pulls the ```latest``` release from the Docker Hub. For a specific release, replace ```latest``` in the script with the released version tag, e.g. ```0.1.0```. In Linux systems, you will probably have to run the command as a sudo unless you create a 'docker' group and add users to it. | ||
|
||
More information on the project can be found in the documentation. | ||
|
||
## Documentation | ||
The [wiki section](https://github.com/tudelft3d/City4CFD/wiki) of this project has details on reconstruction setup and also contains information and suggestions on data preparation. | ||
|
||
## Citation | ||
If you use City4CFD in a scientific context, please cite the following paper: | ||
|
||
Pađen, Ivan, García-Sánchez, Clara and Ledoux, Hugo (2022). Towards Automatic Reconstruction of 3D City Models Tailored for Urban Flow Simulations. *Frontiers in Built Environment*, 8, 2022 [[DOI](https://www.frontiersin.org/articles/10.3389/fbuil.2022.899332)][[BibTeX](https://github.com/tudelft3d/City4CFD/blob/master/CITATION.bib)] | ||
|
||
## Acknowledgements | ||
We would like to acknowdledge the authors of supporting libraries we use in this project: | ||
[CGAL](https://github.com/CGAL/cgal), [nlohmann/json](https://github.com/nlohmann/json), [valijson](https://github.com/tristanpenman/valijson), [LAStools](https://github.com/LAStools) |
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 @@ | ||
docker build -f city4cfd-build-base.dockerfile -t city4cfd-build-base --no-cache . |
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,14 @@ | ||
FROM ubuntu:jammy | ||
LABEL org.opencontainers.image.authors="Ivan Paden <[email protected]>" | ||
LABEL org.opencontainers.image.source="https://github.com/tudelft3d/city4cfd" | ||
LABEL org.opencontainers.image.vendor="Tudelft3D" | ||
LABEL org.opencontainers.image.title="City4CFD build base" | ||
LABEL org.opencontainers.image.description="Base image for building City4CFD" | ||
LABEL org.opencontainers.image.licenses="GPL-3.0" | ||
LABEL org.opencontainers.image.url="https://github.com/tudelft3d/city4cfd" | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
cmake \ | ||
libboost-all-dev \ | ||
libcgal-dev |
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,74 @@ | ||
FROM tudelft3d/city4cfd:build-base AS builder | ||
|
||
ARG JOBS | ||
|
||
# | ||
# Install City4CFD | ||
# | ||
COPY . /tmp | ||
|
||
RUN cd /tmp && \ | ||
mkdir build && \ | ||
cd build && \ | ||
cmake \ | ||
# -DCGAL_DIR=/usr/local \ | ||
# -DCMAKE_BUILD_TYPE=Release \ | ||
# -DBoost_NO_BOOST_CMAKE=TRUE \ | ||
# -DBoost_NO_SYSTEM_PATHS=TRUE \ | ||
# -DBOOST_ROOT=/usr/local \ | ||
.. && \ | ||
make -j $JOBS && \ | ||
make install && \ | ||
cd ~ && \ | ||
rm -rf /tmp/* && \ | ||
rm -rf /user/local/man | ||
|
||
RUN city4cfd --version | ||
|
||
# removing unnecessary headers | ||
RUN rm -rf /usr/local/include | ||
|
||
RUN mkdir /data && \ | ||
chown 1001 /data && \ | ||
chgrp 0 /data && \ | ||
chmod g=u /data && \ | ||
chgrp 0 /etc/passwd && \ | ||
chmod g=u /etc/passwd | ||
|
||
# | ||
# Export the dependencies | ||
# | ||
RUN mkdir /export | ||
COPY docker/strip-docker-image-export /tmp | ||
RUN bash /tmp/strip-docker-image-export \ | ||
-v \ | ||
-d /export \ | ||
-f /bin/bash \ | ||
-f /usr/bin/awk \ | ||
-f /usr/bin/id \ | ||
-f /etc/passwd \ | ||
-f /bin/ls \ | ||
-f /data \ | ||
-f /usr/local/share/proj/proj.db \ | ||
-f /usr/local/bin/city4cfd | ||
|
||
# | ||
# Create City4CFD image | ||
# | ||
FROM scratch AS exe | ||
ARG VERSION | ||
LABEL org.opencontainers.image.authors="Ivan Paden <[email protected]>" | ||
LABEL org.opencontainers.image.source="https://github.com/tudelft3d/city4cfd" | ||
LABEL org.opencontainers.image.vendor="Tudelft3D" | ||
LABEL org.opencontainers.image.title="City4CFD" | ||
LABEL org.opencontainers.image.description="City4CFD image" | ||
LABEL org.opencontainers.image.licenses="GPL-3.0" | ||
LABEL org.opencontainers.image.url="https://github.com/tudelft3d/city4cfd" | ||
LABEL org.opencontainers.image.version=$VERSION | ||
|
||
COPY --from=builder /export/ / | ||
|
||
WORKDIR /data | ||
|
||
ENTRYPOINT ["city4cfd"] | ||
CMD ["--help"] |
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 @@ | ||
# docker-compose.yml | ||
|
||
version: '3.6' | ||
services: | ||
city4cfd: | ||
build: | ||
context: ../ | ||
dockerfile: ./docker/city4cfd.dockerfile | ||
image: tudelft3d/city4cfd:test-container |
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,3 @@ | ||
#!/bin/bash | ||
|
||
docker run --rm -v 'pwd':/data tudelft3d/city4cfd:latest $@ |
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 @@ | ||
docker run --rm -v %cd%:/data tudelft3d/city4cfd:latest %* |
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 @@ | ||
docker run --rm -v "${pwd}:/data" tudelft3d/city4cfd:latest $args |
Oops, something went wrong.