Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ if( NOT CPM_DISABLE )
)

set( CLI11_DIR "${CLI11_BINARY_DIR}" )

CPMAddPackage(
NAME indicators
GITHUB_REPOSITORY p-ranav/indicators
GIT_TAG 3872f37
PATCHES "https://github.com/p-ranav/indicators/pull/130.patch"
)

set( indicators_DIR "${indicators_BINARY_DIR}" )
endif()

find_package( CMakeUtils QUIET )
Expand All @@ -93,6 +102,13 @@ if( CLI11_FOUND )
message( STATUS "Found CLI11: ${CLI11_DIR} ${CLI11_VERSION}" )
endif()

# TODO match indicators and spdlog
# https://github.com/bkryza/clang-uml/blob/fc3fc12/src/common/generators/progress_indicator.cc
find_package( indicators REQUIRED )
if( indicators_FOUND )
message( STATUS "Found indicators: ${indicators_DIR} ${indicators_VERSION}" )
endif()

find_package( Qt6
COMPONENTS
Core REQUIRED
Expand Down
2 changes: 2 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
, git
, texlive
, cli11
, indicators
, pugixml
, qtbase
, wrapQtAppsHook
Expand Down Expand Up @@ -46,6 +47,7 @@ stdenv.mkDerivation {

buildInputs = [
cli11
indicators
(pugixml.override { shared = true; })
qtbase
];
Expand Down
9 changes: 4 additions & 5 deletions doc/openemsh.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ OpenEMSH \- OpenEMS mesher
.SH SYNOPSIS
\fBopenemsh\fR [\fIOPTION\fR] ...
.br
\fBopenemsh\fR [\fICSX_FILE\fR] [\fIOPTION\fR] ...
.br
\fBopenemsh\fR [\fB-i\fR \fICSX_FILE\fR] [\fIOPTION\fR] ...
.br
\fBopenemsh\fR [\fB-i\fR \fICSX_FILE\fR] [\fB-G\fR] [\fIOPTION\fR] ...
Expand All @@ -31,7 +33,7 @@ Verbose mode.
GUI mode (no arguments equals to \fB-G\fR)
.TP
\fB-i\fR \fIFILENAME\fR
Input CSX XML file.
Input CSX XML file. (is also a positional argument)
.TP
\fB-o\fR \fIFILENAME\fR
Output CSX XML file. If different from input, will copy and extend it.
Expand All @@ -54,9 +56,6 @@ Output format.
.RE
.PD
.SS Input options
.TP
\fB--ground\fR \fITEXT\fR ...
Declare properties to be ground planes ('Name' XML field).
.TP
\fB--no-yz\fR
Don't process YZ plane.
Expand Down Expand Up @@ -102,7 +101,7 @@ Currently, diagonals and circular shapes are not supported.
.SH SEE ALSO
@OEMSH_OEMS_MESHING@
.PP
.BR AppCSXCAD (7),
.BR AppCSXCAD (1),

.SH REPORTING BUGS
@OEMSH_BUGREPORT@
Expand Down
47 changes: 47 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
pkgs = final: prev: {
openemsh = prev.qt6.callPackage ./default.nix {
inherit lib;
inherit (final) indicators;
};

openemshMingw64 = prev.pkgsCross.mingwW64.qt6.callPackage ./default.nix {
Expand All @@ -171,6 +172,52 @@

inherit (prev.python3Packages) cairosvg;

indicators = prev.callPackage (
{ lib, stdenv, fetchpatch, fetchFromGitHub, cmake, ninja }:
stdenv.mkDerivation rec {
pname = "indicators";
# version = "2.3";
version = "3872f37";

src = fetchFromGitHub {
owner = "p-ranav";
repo = "indicators";
# rev = "v${version}";
rev = version;
# hash = "sha256-FA07UbuhsA7HThbyxHxS+V4H5ha0LAXU7sukVfPVpdg=";
hash = "sha256-1/Ut6Qilabqq2az5mu3r5vIUV7aXan26wglaY4SDU1U=";
};

patches = [
(fetchpatch {
# https://github.com/p-ranav/indicators/pull/130
url = "https://github.com/p-ranav/indicators/pull/130.patch";
hash = "sha256-OEF6CnCPMBCETm5MEtF1DmbNCs+UK54lSE4e1S6zAmc=";
})
# (fetchpatch {
# # https://github.com/p-ranav/indicators/pull/133
# url = "https://github.com/p-ranav/indicators/pull/133.patch";
# hash = "sha256-A3HZnBE8JNKMZprmmIZNLfa8eyCzSBKhvmpmNhiIgK0=";
# })
];

nativeBuildInputs = [ cmake ninja ];

cmakeFlags = [
"-DBUILD_SHARED_LIBS=ON"
"-DINDICATORS_SAMPLES=OFF"
"-DINDICATORS_DEMO=OFF"
"-DINDICATORS_TESTS=OFF"
];

meta = with lib; {
description = "Activity Indicators for Modern C++";
homepage = "https://github.com/p-ranav/indicators";
license = licenses.mit;
maintainers = with maintainers; [];
};
}) {};

csxcad = (prev.csxcad.overrideAttrs (new: old: {
version = "0.6.3";
src = prev.fetchFromGitHub {
Expand Down
2 changes: 1 addition & 1 deletion pack/openemsh.desktop
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Desktop Entry]
Name=OpenEMSH
TryExec=openemsh
Exec=bash -c "F="%f" && test -n "$F" && openemsh -G -i $F || openemsh"
Exec=openemsh -G %f
Icon=openemsh
Type=Application
Comment=OpenEMS mesher draft
Expand Down
6 changes: 5 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ target_sources( openemsh
"${CMAKE_CURRENT_SOURCE_DIR}/utils/entity.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/utils/tree_node.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/utils/state_management.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/utils/progress.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/domain/geometrics/space.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/domain/geometrics/relation.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/domain/geometrics/bounding.cpp"
Expand Down Expand Up @@ -80,7 +81,8 @@ add_executable( openemsh_bin WIN32 )

target_sources( openemsh_bin
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/ui/cli.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ui/cli/cli.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ui/cli/progress.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ui/qt/utils/nodegraph/highlightable.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ui/qt/utils/nodegraph/port.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ui/qt/utils/nodegraph/text.cpp"
Expand Down Expand Up @@ -122,6 +124,7 @@ target_sources( openemsh_bin
"${CMAKE_CURRENT_SOURCE_DIR}/ui/qt/about_dialog.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ui/qt/icons.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ui/qt/main_window.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ui/qt/progress.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ui/qt/style.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ui/qt/resources.qrc"
"${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
Expand Down Expand Up @@ -163,6 +166,7 @@ target_link_libraries( openemsh_bin
PRIVATE
openemsh
CLI11::CLI11
indicators::indicators
Qt6::Core
Qt6::Gui
Qt6::Widgets
Expand Down
10 changes: 10 additions & 0 deletions src/app/openemsh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,16 @@ bool OpenEMSH::can_go_before() const {
return Caretaker::singleton().find_first_ancestor_with_annotation();
}

//******************************************************************************
optional<Step> OpenEMSH::get_current_step() const {
auto& c = Caretaker::singleton();
auto* t = c.find_first_ancestor_with_annotation(true);
if(auto const* a = c.get_annotation(t); a)
return static_cast<Annotation const*>(a)->before_step;
else
return nullopt;
}

//******************************************************************************
Annotation::Annotation(Step before_step)
: before_step(before_step)
Expand Down
11 changes: 1 addition & 10 deletions src/app/openemsh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ class OpenEMSH {
PRETTYPRINT
} output_format = OutputFormat::CSX;

bool with_step_adjust_edges_to_material = true;
bool with_step_detect_edges_in_polygons = true;
bool with_step_detect_colinear_edges = true;
bool with_step_auto_solve_all_edge_in_polygon = true;
bool with_step_auto_solve_all_colinear_edges = true;
bool with_step_detect_individual_edges = true;
bool with_step_detect_and_solve_too_close_meshline_policies = true;
bool with_step_detect_intervals = true;
bool with_step_mesh = true;

std::function<void (domain::Params&)> override_from_cli;
};

Expand All @@ -76,6 +66,7 @@ class OpenEMSH {

bool can_run_a_next_step() const;
bool can_go_before() const;
std::optional<Step> get_current_step() const;
private:
Params params;
std::shared_ptr<domain::Board> board;
Expand Down
29 changes: 29 additions & 0 deletions src/app/steps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#pragma once

#include <optional>

#include "utils/unreachable.hpp"

namespace app {

//******************************************************************************
Expand All @@ -22,4 +26,29 @@
MESH
};

// TODO refactor with ITERABLE_ENUM

Check warning on line 29 in src/app/steps.hpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this "TODO" comment.

See more on https://sonarcloud.io/project/issues?id=Open-RFlab_openemsh&issues=AZq3KFCqXEw3S7GOf2PT&open=AZq3KFCqXEw3S7GOf2PT&pullRequest=31
//******************************************************************************
inline std::size_t index(std::optional<Step> step) {
if(!step.has_value()) return 0;

switch(step.value()) {

Check warning on line 34 in src/app/steps.hpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Reduce verbosity with "using enum" for "app::Step".

See more on https://sonarcloud.io/project/issues?id=Open-RFlab_openemsh&issues=AZq3KFCqXEw3S7GOf2PU&open=AZq3KFCqXEw3S7GOf2PU&pullRequest=31
case Step::ADJUST_EDGE_TO_MATERIAL: return 1;
case Step::DETECT_CONFLICT_EIP: return 2;
case Step::DETECT_CONFLICT_CE: return 3;
case Step::ADD_FIXED_MLP: return 4;
case Step::SOLVE_ALL_EIP: return 5;
case Step::SOLVE_ALL_CE: return 6;
case Step::DETECT_INDIVIDUAL_EDGES: return 7;
case Step::DETECT_AND_SOLVE_TCMLP: return 8;
case Step::DETECT_INTERVALS: return 9;
case Step::MESH: return 10;
default: ::unreachable();
}
}

//******************************************************************************
inline std::size_t index_max() {
return index(Step::MESH);
}

} // namespace app
Loading
Loading