[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:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user