FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
NetSpecReport.h
1#pragma once
2
3#include "CTrawlNetAssembler.h"
4#include "SCableSectionData.h"
5
6#include <array>
7#include <marenv/marenv.h>
8#include <string>
9#include <utility>
10#include <vector>
11
16namespace netspec
17{
19namespace report
20{
23constexpr double kGravity = marenv::gravity;
24
25// The thresholds of the warnings; README, "trawlwriter report", explains each.
27constexpr double kMaxLineToEdge = 1.1;
29constexpr double kMinLineToEdge = 0.2;
31constexpr double kMaxJoinMismatch = 0.1;
34constexpr double kPointEdge = 20;
36constexpr double kMeantAsPoint = 5;
38constexpr double kMaxElementMeshes = 200;
39
42{
43 double twineLength = 0;
44 double twineWeightInWater = 0;
45 int numFloats = 0;
47 double floatBuoyancy = 0;
48 int numBobbins = 0;
50 double stretchedArea = 0;
51 double squareMeshArea = 0;
52 double solidity = 0;
53 int elements = 0;
54 int nodes = 0;
55 int cables = 0;
57 int refinedNodes = 0;
58 int refinedCables = 0;
59};
60
62struct Point
63{
64 double x;
65 double y;
66};
67
69Point Along(Point a, Point b, double fraction);
70
73{
74 int number = 0;
75 bool mirrored = false;
76 TrawlSpec::ESectionType_t type = TrawlSpec::SECTIONTYPE_BELLY;
77 double refine = 1;
78 std::array<Point, TrawlSpec::SectionNode_NUM> corners {};
79 std::array<int, TrawlSpec::SectionNode_NUM> nodes {};
80};
81
84{
85 TrawlSpec::EPanel_t panel = TrawlSpec::PANEL_UPPER;
86 int aftMost = 0;
87 int behindWings = 0;
88 int wings = 0;
89 std::vector<SectionShape> sections;
90
92 const SectionShape* Copy(int index) const
93 {
94 const int copy = index + wings;
95 return sections[index].type == TrawlSpec::SECTIONTYPE_WING && copy < static_cast<int>(sections.size()) ? &sections[copy] : nullptr;
96 }
97};
98
102{
103 std::vector<std::pair<Point, Point>> segments;
104 bool divided = false;
105 double stretched = 0;
106};
107
109struct Item
110{
111 bool isFloat;
112 double size;
113 double at;
115 double fraction;
116};
117
119std::vector<Item> ItemsOf(const SCableSectionData& line, bool divided);
120
122double SphereVolume(double d);
123
125double DiskVolume(double d, double thickness);
126
129
131std::string Fixed(double value, int decimals);
132
134std::string Trimmed(double value, int decimals);
135
137std::string PanelName(TrawlSpec::EPanel_t panel);
138
140std::string SideName(TrawlSpec::ESectionSide_t side);
141
142} // namespace report
143
146{
148 std::string name;
149 report::NetTotals totals;
150 std::vector<std::string> warnings;
151 std::vector<report::PanelShape> panels;
153 std::vector<std::vector<std::pair<SCableSectionData, report::LineEdge>>> panelLines;
154};
155
157NetSpecReport MakeNetSpecReport(const std::string& specPath);
158} // namespace netspec
Class used to collect and contain the specification of a trawl net.
Definition CTrawlNetAssembler.h:31
constexpr double gravity
Gravity constant [m/s^2].
Definition marenv.h:19
constexpr double seawaterDensity
Ocean water density [kg/m^3].
Definition marenv.h:20
std::string Trimmed(double value, int decimals)
value with at most decimals decimals, without trailing zeros.
bool IsRefined(CTrawlNetAssembler &net)
Whether the net is refined by Net/NetStructure (MaxNumPanels or MaxEdgeLengthFactor given).
std::string PanelName(TrawlSpec::EPanel_t panel)
"Upper", "Lower" or "Side".
double DiskVolume(double d, double thickness)
The volume of a disk of diameter d and thickness.
Point Along(Point a, Point b, double fraction)
The point fraction of the way from a to b.
double SphereVolume(double d)
The volume of a sphere of diameter d.
constexpr double kMeantAsPoint
... an edge of fewer meshes than this is taken to be meant as a point.
Definition NetSpecReport.h:36
constexpr double kMaxJoinMismatch
Joined edges of adjoining sections that differ by more than this fraction of the longer,...
Definition NetSpecReport.h:31
constexpr double kMinLineToEdge
A line shorter than this fraction of its netting edge stretched gathers the netting more than hanging...
Definition NetSpecReport.h:29
constexpr double kPointEdge
Definition NetSpecReport.h:34
std::vector< Item > ItemsOf(const SCableSectionData &line, bool divided)
The floats and bobbins of line, as Items; divided: the line is a divided one (two halves).
std::string Fixed(double value, int decimals)
value with decimals decimals, never "-0"; "n/a" for a value that is not finite.
std::string SideName(TrawlSpec::ESectionSide_t side)
The name of a section side, as the specification spells it: "Front", "Back", "Outer",...
constexpr double kMaxLineToEdge
A line longer than its netting edge stretched by more than this factor cannot be hung with that edge.
Definition NetSpecReport.h:27
constexpr double kRhoWater
Sea water density (kg/m³) and gravity (m/s²), as Net/NetStructure's elements take them.
Definition NetSpecReport.h:22
constexpr double kMaxElementMeshes
A net element, after refinement, longer than this many meshes along an edge, stretched.
Definition NetSpecReport.h:38
Reads a trawl net from an XML net specification (doc/user/net-specification.md).
Definition NetSpecReport.h:17
NetSpecReport MakeNetSpecReport(const std::string &specPath)
The analysis of the net specification specPath. Throws NetSpecError for a specification ReadNetSpec r...
Definition SCableSectionData.h:11
The analysis of a net specification, by MakeNetSpecReport.
Definition NetSpecReport.h:146
std::string name
The net's Name.
Definition NetSpecReport.h:148
CTrawlNetAssembler net
The meshed net.
Definition NetSpecReport.h:147
std::vector< std::vector< std::pair< SCableSectionData, report::LineEdge > > > panelLines
Per panel (as in panels), its lines with the edges they run along.
Definition NetSpecReport.h:153
std::vector< report::PanelShape > panels
Definition NetSpecReport.h:151
A float or a bobbin on a line.
Definition NetSpecReport.h:110
double size
Along the line: a float's diameter, a bobbin's thickness.
Definition NetSpecReport.h:112
int segment
The LineEdge segment it is on; -1: on each.
Definition NetSpecReport.h:114
double fraction
Along that segment.
Definition NetSpecReport.h:115
double at
From the line's start, m.
Definition NetSpecReport.h:113
Definition NetSpecReport.h:102
double stretched
The netting edge the line holds, stretched: one side's, or the whole of a divided line's.
Definition NetSpecReport.h:105
The totals of the whole net, port and starboard.
Definition NetSpecReport.h:42
double twineWeightInWater
N.
Definition NetSpecReport.h:44
int numSinkingFloats
Floats not lighter than water.
Definition NetSpecReport.h:46
double stretchedArea
m², every mesh stretched
Definition NetSpecReport.h:50
double floatBuoyancy
N, upwards; a float denser than water counts negative.
Definition NetSpecReport.h:47
double solidity
projected twine area / squareMeshArea
Definition NetSpecReport.h:52
int refinedElements
after Net/NetStructure's refinement
Definition NetSpecReport.h:56
double squareMeshArea
m², every mesh open to a square (opening angle 90°)
Definition NetSpecReport.h:51
int cables
cable elements of the lines
Definition NetSpecReport.h:55
double bobbinWeightInWater
N.
Definition NetSpecReport.h:49
double twineLength
m
Definition NetSpecReport.h:43
int elements
net elements, as meshed (the net file)
Definition NetSpecReport.h:53
A panel as drawn: its sections, the wing copies last.
Definition NetSpecReport.h:84
int behindWings
Belly and splitter sections.
Definition NetSpecReport.h:87
int aftMost
The number of its aftmost section.
Definition NetSpecReport.h:86
int wings
Wing sections of one wing.
Definition NetSpecReport.h:88
const SectionShape * Copy(int index) const
The other wing's copy of wing section index, or nullptr.
Definition NetSpecReport.h:92
A position on a panel, as the mesher draws it: metres at square meshes, x forward from the aft end,...
Definition NetSpecReport.h:63
A section as drawn: its corners and their node numbers (-1: none).
Definition NetSpecReport.h:73
int number
Counted from the aft end of the net.
Definition NetSpecReport.h:74
bool mirrored
The other wing's copy of a wing section.
Definition NetSpecReport.h:75