[Mesh] Improve unit tests

Add a test for the CTRIA3 element, and add code to check the used nodes
and cancel the file load if they don't all exist.
This commit is contained in:
Chris Hennes
2021-09-25 19:42:00 -05:00
parent 1b20118dfa
commit bd4623a2a3
5 changed files with 55 additions and 6 deletions

View File

@@ -1808,7 +1808,27 @@ bool MeshInput::LoadNastran (std::istream &rstrIn)
}
if (badElementCounter > 0) {
Base::Console().Warning("Found bad elements while reading NASTRAN file.");
Base::Console().Warning("Found bad elements while reading NASTRAN file.\n");
}
// Check the triangles to make sure the vertices they refer to actually exist:
for (const auto& tri : mTria) {
for (int i = 0; i < 3; ++i) {
if (mNode.find(tri.second.iV[i]) == mNode.end()) {
Base::Console().Error("CTRIA3 element refers to a node that does not exist, or could not be read.\n");
return false;
}
}
}
// Check the quads to make sure the vertices they refer to actually exist:
for (const auto& quad : mQuad) {
for (int i = 0; i < 4; ++i) {
if (mNode.find(quad.second.iV[i]) == mNode.end()) {
Base::Console().Error("CQUAD4 element refers to a node that does not exist, or could not be read.\n");
return false;
}
}
}
float fLength[2];