-
Notifications
You must be signed in to change notification settings - Fork 55
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
Feature: Add a scalar and vector data field to VTK write test [2/3] #1488
base: main
Are you sure you want to change the base?
Conversation
Note: even though writing of ghosts was set true (and not changed by this commit), the ghost elements do not seem to be written, which is odd. |
Could be resolved, the forest in the example was build without a ghost layer. |
…iter' into feature-extend_vtk_test_with_data
The tests fail in VTK API mode due to a ghost tree being requested by grid_element_shape and the function expecting only local trees. |
void | ||
vtk_writer_test_fill_data (const t8_locidx_t cells_to_write_count, std::vector<double> &scalar_data, | ||
std::vector<double> &vector_data) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | |
{ | |
scalar_data.resize (cells_to_write_count); | |
vector_data.resize (3 * cells_to_write_count); |
I think it is better to use a single allocation instead of cells_to_write_count
many
// vector[n] = (n/10.) | ||
// Fill vector data vector with entries (0, 0, 42), (0.1,-0.1,42), ... | ||
// vector[n] = (n/10.,-n/10., 42) | ||
for (t8_locidx_t icell = 0; icell < cells_to_write_count; ++icell) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (t8_locidx_t icell = 0; icell < cells_to_write_count; ++icell) { | |
std::iota(scalar_data.begin(), scalar_data.end(), 0); | |
std::transform(scalar_data.begin(), scalar_data.end(), scalar_data.begin(), [](double val) { return val / 10.; }); | |
std::generate(vector_data.begin(), vector_data.end(), [n = 0]() mutable { | |
double scalar_value = (n / 10.); | |
double vector_values[3] = { scalar_value, -scalar_value, 42. }; | |
return vector_values[n++ % 3]; | |
}); |
we could replace the loop by stl commands then. It has the drawback of looping three times over the arrray, though, so I would be okay with just removing the allocation from the loop too.
Describe your changes here:
The first step towards #1487.
The vtk_writer example did not write any user data.
Extended the example with 2 data fields, one scalar, one vector and dummy data.
The data fields do already contain values for the ghost elements.
All these boxes must be checked by the AUTHOR before requesting review:
Documentation:
,Bugfix:
,Feature:
,Improvement:
orOther:
.All these boxes must be checked by the REVIEWERS before merging the pull request:
As a reviewer please read through all the code lines and make sure that the code is fully understood, bug free, well-documented and well-structured.
General
Tests
If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):
Scripts and Wiki
script/find_all_source_files.scp
to check the indentation of these files.Tag Label
License
doc/
(or already has one).