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

TecPlot utility #2114

Merged
merged 4 commits into from Apr 25, 2018

Conversation

Projects
None yet
3 participants
@rinkk
Copy link
Member

rinkk commented Apr 20, 2018

Currently can

  • split TecPlot files containing multiple "zones" (i.e. timesteps, subdomains, etc.) into seperate tecplot files
  • convert TecPlot files representing raster data into ogs-meshes (one file per zone, containing all variables as scalar arrays)
std::pair<std::size_t, std::size_t> dims(0,0);
std::size_t val_count(0), val_total(0);
std::size_t write_count(0);
while (getline(in, line))

This comment has been minimized.

@TomFischer

TomFischer Apr 23, 2018

Member

std::getline?

This comment has been minimized.

@rinkk

rinkk Apr 24, 2018

Author Member

✔️

/// Splits a TecPlot file containing multiple sections/zones into seperate files
int splitFile(std::ifstream& in, std::string file_name)
{
std::ofstream out;

This comment has been minimized.

@TomFischer

TomFischer Apr 23, 2018

Member

Where is out initialized? What is the purpose of out?

This comment has been minimized.

@rinkk

rinkk Apr 24, 2018

Author Member

out is initalised / switched to the next file / closed in writeTecPlotSection()

{
std::ofstream out;
std::string line("");
std::string name;

This comment has been minimized.

@TomFischer

TomFischer Apr 23, 2018

Member

The created name object is empty. It is used, for instance, in line 245 and 252, but will be initialized in line 262. Could this be a problem?

This comment has been minimized.

@rinkk

rinkk Apr 24, 2018

Author Member

removed all instances ("")

std::ofstream out;
std::string line("");
std::string name;
std::pair<std::size_t, std::size_t> dims(0,0);

This comment has been minimized.

@TomFischer

TomFischer Apr 23, 2018

Member

dims could be more local, it is used as a temporary variabele while parsing the zone.

val_count++;
}
if (dataCountError(out, name, val_count, val_total))
return -3;

This comment has been minimized.

@TomFischer

TomFischer Apr 23, 2018

Member

Why -3? It seems the method could return a bool value.

This comment has been minimized.

@rinkk

rinkk Apr 24, 2018

Author Member

Different values indicate different reasons for failing. -3 is indicating an index error.

This comment has been minimized.

@endJunction

endJunction Apr 24, 2018

Member

I'd recommend to document the magic numbers.

This comment has been minimized.

@rinkk

rinkk Apr 25, 2018

Author Member

I put an explanation on the exit codes in the documentation. Independent of that, a detailed error-message is output in each case.

std::size_t const n_scalars (scalars.size());
while (iss >> x)
{
if (i > n_scalars-1)

This comment has been minimized.

@TomFischer

TomFischer Apr 23, 2018

Member

Is it possible that n_scalars is zero at this point? I'm not sure, but n_scalars - 1 is probably very large. Is this okay?

This comment has been minimized.

@rinkk

rinkk Apr 24, 2018

Author Member

Barring an invalid TecPlot-file, n_scalars must be larger than 0, otherwise the zone-section would contain no data.

@rinkk rinkk force-pushed the rinkk:TecPlotTools2 branch from 8fe718d to 659391d Apr 24, 2018

@endJunction
Copy link
Member

endJunction left a comment

Minor comment on documentation.
If you would run clang-format on the changes before merging, it would be nice.

@TomFischer
Copy link
Member

TomFischer left a comment

@endJunction endJunction merged commit 1ce838b into ufz:master Apr 25, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/jenkins/pr-merge This commit looks good
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.