Dear deal.II community,

I am trying to read a second order tensor from a .prm file using the 
ParameterHandler functionalities. The tensor (for dim=3) is set in .prm 
file as

  set macro def grad = 1.2|0.0|0.0|0.0|1.1|0.0|0.0|0.0|1.4

and is currently read as a string using 
parameterHandler.declare_entry(
          "macro def grad",
          "1.0|1.0|1.0|1.0",
          dealii::Patterns::Anything(),
          "Macroscopic deformation gradient for homogenization");

auto temp = parameterHandler.get("macro def grad");
std::vector<std::string> defGradComps;
boost::algorithm::split(defGradComps,
                        temp,
                       boost::algorithm::is_any_of("|"));
Assert(defGradComps.size() == dim * dim,
       dealii::ExcDimensionMismatch(defGradComps.size(),
                                                dim * dim));
           for (mncfrac::utilities::UnsignedIntType i = 0; i < dim; ++i)
              for (mncfrac::utilities::UnsignedIntType j = 0; j < dim; ++j)
                this->problemSpecificParameters_.macroDefGrad_[i][j] =
                  std::stod(defGradComps[i * dim + j]);


I am curious to know, if there is a smarter way (avoiding this manual 
copying by looping over the tensor entries) to do so using some other type 
of dealii::Patterns object or some other way.

Thanks in advance and best regards,
Paras Kumar

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/595804dd-818f-4fd6-86ba-f4e3d7d378a6%40googlegroups.com.

Reply via email to