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

Add print_helper for double vector (#845) #846

Merged
merged 1 commit into from
Mar 2, 2016
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
14 changes: 13 additions & 1 deletion include/utils/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,17 @@
namespace libMesh
{
/**
* Helper functions for printing scalar and vector types. Called from Parameters::Parameter<T>::print(...).
* Helper functions for printing scalar, vector and vector<vector> types. Called from Parameters::Parameter<T>::print(...).
*/
template<typename P>
void print_helper(std::ostream & os, const P * param);

template<typename P>
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);

/**
* This class provides the ability to map between
* arbitrary, user-defined strings and several data
Expand Down Expand Up @@ -546,6 +549,15 @@ void print_helper(std::ostream & os, const std::vector<P> * param)
os << (*param)[i] << " ";
}

//non-member vector<vector> print function
template<typename P>
void print_helper(std::ostream & os, const std::vector<std::vector<P> > * param)
{
for (unsigned int i=0; i<param->size(); ++i)
for (unsigned int j=0; j<(*param)[i].size(); ++j)
os << (*param)[i][j] << " ";
}

} // namespace libMesh

#endif // LIBMESH_PARAMETERS_H