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

print_helper using 3D vector argument #3381

Merged
merged 1 commit into from
Aug 25, 2022
Merged
Changes from all commits
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
16 changes: 15 additions & 1 deletion include/utils/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
namespace libMesh
{
/**
* Helper functions for printing scalar, vector and vector<vector> types. Called from Parameters::Parameter<T>::print(...).
* Helper functions for printing scalar, vector, vector<vector> and vector<vector<vector>>
* types. Called from Parameters::Parameter<T>::print(...).
*/
template<typename P>
void print_helper(std::ostream & os, const P * param);
Expand All @@ -48,6 +49,9 @@ void print_helper(std::ostream & os, const std::vector<P> * param);
template<typename P>
void print_helper(std::ostream & os, const std::vector<std::vector<P>> * param);

template<typename P>
void print_helper(std::ostream & os, const std::vector<std::vector<std::vector<P>>> * param);

template<typename P1, typename P2, typename C, typename A>
void print_helper(std::ostream & os, const std::map<P1, P2, C, A> * param);

Expand Down Expand Up @@ -566,6 +570,16 @@ void print_helper(std::ostream & os, const std::vector<std::vector<P>> * param)
os << p << " ";
}

//non-member vector<vector<vector>> print function
template<typename P>
void print_helper(std::ostream & os, const std::vector<std::vector<std::vector<P>>> * param)
{
for (const auto & pvv : *param)
for (const auto & pv : pvv)
for (const auto & p : pv)
os << p << " ";
}

//non-member map print function
template<typename P1, typename P2, typename C, typename A>
void print_helper(std::ostream & os, const std::map<P1, P2, C, A> * param)
Expand Down