62{
63 if (this->newMeshNameEdit->text().size() == 0)
64 {
66 return;
67 }
68
69 bool anything_checked(false);
70
74 if (this->elementTypeCheckBox->isChecked())
75 {
76 QList<QListWidgetItem*> items =
77 this->elementTypeListWidget->selectedItems();
78 for (auto& item : items)
79 {
80 ex.searchByElementType(
82 }
83 anything_checked = true;
84 }
85 if (this->scalarArrayCheckBox->isChecked())
86 {
87 std::string const array_name =
88 this->scalarArrayComboBox->currentText().toStdString();
89 double min_val;
90 double max_val;
91 bool outside = this->outsideButton->isChecked();
92 if (outside)
93 {
94 min_val = this->outsideScalarMinEdit->text().toDouble();
95 max_val = this->outsideScalarMaxEdit->text().toDouble();
96 }
97 else
98 {
99 min_val = this->insideScalarMinEdit->text().toDouble();
100 max_val = this->insideScalarMaxEdit->text().toDouble();
101 }
102
103 std::size_t n_marked_elements(0);
105 {
106 n_marked_elements = ex.searchByPropertyValueRange<double>(
107 array_name, min_val, max_val, outside);
108 }
110 {
111 int const lbound = static_cast<int>(min_val);
112 int const rbound = static_cast<int>(max_val);
113 n_marked_elements = ex.searchByPropertyValueRange<int>(
114 array_name, lbound, rbound, outside);
115 }
116
117 if (n_marked_elements > 0)
118 {
119 anything_checked = true;
120 }
121 }
122 if (this->boundingBoxCheckBox->isChecked())
123 {
124 std::vector<MeshLib::Node*> const& nodes(
126 .
getMesh(this->meshNameComboBox->currentText().toStdString())
127 ->getNodes());
129 auto [minAABB, maxAABB] = aabb.getMinMaxPoints();
130
131
132
133 minAABB[0] =
134 (
aabb_edits[0]) ? this->xMinEdit->text().toDouble() : (minAABB[0]);
135 maxAABB[0] =
136 (
aabb_edits[1]) ? this->xMaxEdit->text().toDouble() : (maxAABB[0]);
137 minAABB[1] =
138 (
aabb_edits[2]) ? this->yMinEdit->text().toDouble() : (minAABB[1]);
139 maxAABB[1] =
140 (
aabb_edits[3]) ? this->yMaxEdit->text().toDouble() : (maxAABB[1]);
141 minAABB[2] =
142 (
aabb_edits[4]) ? this->zMinEdit->text().toDouble() : (minAABB[2]);
143 maxAABB[2] =
144 (
aabb_edits[5]) ? this->zMaxEdit->text().toDouble() : (maxAABB[2]);
145 std::vector<Eigen::Vector3d, Eigen::aligned_allocator<Eigen::Vector3d>>
146 extent{minAABB, maxAABB};
147 const GeoLib::AABB updated_aabb(extent.begin(), extent.end());
148 ex.searchByBoundingBox(updated_aabb,
149 this->invertBoundingBoxCheckBox->isChecked());
150 anything_checked = true;
151 }
152
153 if (this->zeroVolumeCheckBox->isChecked())
154 {
155 ex.searchByContent();
156 anything_checked = true;
157 }
158
159 if (anything_checked)
160 {
162 *msh, ex.getSearchedElementIDs(),
163 this->newMeshNameEdit->text().toStdString());
164 if (new_mesh)
165 {
167 }
168 else
169 {
170 if (ex.getSearchedElementIDs().empty())
171 {
173 "The current selection removes NO mesh elements.");
174 }
175 return;
176 }
177 }
178 else
179 {
181 return;
182 }
183
184 this->done(QDialog::Accepted);
185}
const MeshLib::Mesh * getMesh(const std::string &name) const
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
void meshAdded(MeshLib::Mesh *mesh)
std::array< bool, 6 > aabb_edits
Properties & getProperties()
bool existsPropertyVector(std::string_view name) const
MeshElemType String2MeshElemType(const std::string &s)
Given a string of the shortened name of the element type, this returns the corresponding MeshElemType...
OGSMesh getMesh(std::string const &name)