Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expansion of GoCAD interface #2586

Merged
merged 15 commits into from
Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
adjusting variable scope and default parameters
  • Loading branch information
rinkk authored and TomFischer committed Aug 12, 2019
commit 10eb95941e65c1348b7b80aaa33ae6fd1adb4d5c
15 changes: 5 additions & 10 deletions Applications/FileIO/GocadIO/GocadAsciiReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ namespace Gocad
const std::string mat_id_name = "MaterialIDs";
const std::string eof_error = "Error: Unexpected end of file.";

GocadAsciiReader::GocadAsciiReader()
: _export_type(GocadDataType::ALL) {}

GocadAsciiReader::GocadAsciiReader(GocadDataType const t)
Copy link
Member

@endJunction endJunction Aug 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GocadAsciiReader::GocadAsciiReader(GocadDataType const t)
GocadAsciiReader::GocadAsciiReader(GocadDataType const t = GocadDataType::ALL)

... then the default ctor is not needed.
(Sorry, wrong place, goes into the header file)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

: _export_type(t)
{}
Expand Down Expand Up @@ -63,8 +60,7 @@ bool GocadAsciiReader::readFile(
std::ifstream in(file_name.c_str());
if (!in.is_open())
{
ERR("GocadAsciiReader::readFile(): Could not open file %s.",
file_name.c_str());
ERR("GocadAsciiReader::readFile(): Could not open file %s.", file_name.c_str());
return false;
}

Expand All @@ -82,7 +78,7 @@ bool GocadAsciiReader::readFile(
if (!skipToEND(in))
{
std::string const t = (type == GocadDataType::VSET) ? "VSet" : "Model3D";
ERR("Parsing of type %s is not implemented. Skipping section.", t);
ERR("Parsing of type %s is not implemented. Skipping section.", t.c_str());
return false;
}
continue;
Expand Down Expand Up @@ -174,8 +170,7 @@ MeshLib::Mesh* GocadAsciiReader::readData(std::ifstream& in,
}
else
{
WARN("GocadAsciiReader::readData() - Unknown keyword found: %s",
line.c_str());
WARN("GocadAsciiReader::readData() - Unknown keyword found: %s", line.c_str());
}
}
ERR("%s", eof_error.c_str());
Expand Down Expand Up @@ -492,7 +487,6 @@ bool GocadAsciiReader::parseLineSegments(
std::map<std::size_t, std::size_t> const& node_id_map,
MeshLib::Properties& mesh_prop)
{
std::array<std::size_t, 3> data;
MeshLib::PropertyVector<int>& mat_ids =
*mesh_prop.getPropertyVector<int>(mat_id_name);
int current_mat_id(0);
Expand All @@ -513,6 +507,7 @@ bool GocadAsciiReader::parseLineSegments(
{
std::stringstream sstr(line);
std::string keyword;
std::array<std::size_t, 2> data;
sstr >> keyword >> data[0] >> data[1];
std::array<MeshLib::Node*, 2> elem_nodes;
for (std::size_t i = 0; i < 2; ++i)
Expand Down Expand Up @@ -547,7 +542,6 @@ bool GocadAsciiReader::parseElements(
std::map<std::size_t, std::size_t> const& node_id_map,
MeshLib::Properties& mesh_prop)
{
std::array<std::size_t, 3> data;
MeshLib::PropertyVector<int>& mat_ids =
*mesh_prop.getPropertyVector<int>(mat_id_name);
int current_mat_id(0);
Expand All @@ -568,6 +562,7 @@ bool GocadAsciiReader::parseElements(
{
std::stringstream sstr(line);
std::string keyword;
std::array<std::size_t, 3> data;
sstr >> keyword >> data[0] >> data[1] >> data[2];
std::array<MeshLib::Node*, 3> elem_nodes;
for (std::size_t i = 0; i < 3; ++i)
Expand Down
6 changes: 2 additions & 4 deletions Applications/FileIO/GocadIO/GocadAsciiReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ enum class GocadDataType
class GocadAsciiReader final
{
public:
explicit GocadAsciiReader();

/// Constructor taking a specific data type (will only export that type)
explicit GocadAsciiReader(GocadDataType const t);
/// Constructor
explicit GocadAsciiReader(GocadDataType const t = GocadDataType::ALL);

/// Reads the specified file and writes data into internal mesh vector
bool readFile(std::string const& file_name,
Expand Down