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

Base64 I/O for Paraview and XML #634

Open
wants to merge 14 commits into
base: stable
Choose a base branch
from
Open

Conversation

jzwar
Copy link
Contributor

@jzwar jzwar commented Aug 31, 2023

Motivation

Although I was aware of the gismo-PR #236, I saw that there has not been an update since 2018 and it also relies on an external library. Further, it only acted on the XML-files without support for Paraview exports.

The need to redo the implementation of this feature originated as we had fields with very small magnitudes, which is very tedious with fixed-point string conversion.

Implementation

The implementation is based on this, which I implemented as an interface to @j042's python library splinepy. It relied on c++17 features, so adaptations were required, and further overloads for gsMatrix were added. The ToVTK-function was updated accordingly.

Details

  • Moved functions related to GoTools into a separate file, although it seems to be used nowhere (?)
  • Added a new class of static functions only for base64 encoding and decoding
  • Added base64 option to Paraview collection and added argument to toVTK
  • Updated some variable names to make code clearer, formatted modified sections
  • XML I/O

Complementary

I would add the following, should there be a demand for it:

  • Support KnotVectors in XML input
  • Tests for De/Encoding (they already exist, but I did not know where to put them)

@jzwar jzwar requested a review from a team as a code owner August 31, 2023 16:04
@mmoelle1
Copy link
Contributor

mmoelle1 commented Sep 1, 2023

I think that adding base64 support for the knot vectors would be very good. We are planning to implement something similar to the Geometry tag to write solutions as native spline objects in XML. These solutions will often have many coefficients and hence benefit largely from base64 support.

@jzwar
Copy link
Contributor Author

jzwar commented Sep 12, 2023

I think that adding base64 support for the knot vectors would be very good. We are planning to implement something similar to the Geometry tag to write solutions as native spline objects in XML. These solutions will often have many coefficients and hence benefit largely from base64 support.

Done and rebased

@filiatra
Copy link
Member

filiatra commented Mar 6, 2024

Very usefull !
Tests can go in a new file inside /unittests
Please set in cmake GISMO_BUILD_UNITTESTS=ON
to be able to compile (make unitttestss) and run (./bin/unittests) the unittests.

@jzwar
Copy link
Contributor Author

jzwar commented Mar 10, 2024

@filiatra As discussed, I looked into the structure date is currently written to file. Adding a flag to gsFileData will not be sufficient. Streaming a file into gsFileData calls the put function, which is non-member. So, as far as I can see, no trivial way to add format flags to the output of the children without changing the layout of every put function.

@filiatra
Copy link
Member

OK then let's go on with this one as it is and let the writing for later.

base_type_flag_.reserve(base_type_flag.size());
std::transform(base_type_flag.cbegin(), base_type_flag.cend(),
std::back_inserter(base_type_flag_),
[](unsigned char c) { return std::tolower(c); });
Copy link
Member

Choose a reason for hiding this comment

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

Please use "::tolower" instead of "std::tolower" because some windows compiles like it better.

std::string format_flag = format ? format->value() : "ascii";
std::transform(format_flag.cbegin(), format_flag.cend(),
format_flag.begin(),
[](unsigned char c) { return std::tolower(c); });
Copy link
Member

Choose a reason for hiding this comment

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

Please use "::tolower" instead of "std::tolower" because some windows compiles like it better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants