as I understand this function is to include the .prm file input data. What I have is inside my .prm file:
subsection somedata
set input file = xyz.data
end
I read this input string from .prm and via my own implemented function read this xyz.data file. The problem occurs when doing unit test for different .prm input files it cannot read this xyz.data file. The different .prm files are considered by the unit test but the xyz.data within each .prm file is not read.
std::ifstream in(SOURCE_DIR "parameters.prm"); |
Vinayak,
Your error looks like you are trying to call read_input on your data file instead of the parameter file.
At least you seem to be able to find the correct path to your data file in the unit test and this is what this thread
is about, isn't it?
Do you have a working setting (without the testsuite setup) for which you can treat your data file appropriately?
If this works, we can try to find out why it doesn't work using the testuite setting.
Your error looks like you are trying to call read_input on your data file instead of the parameter file.
At least you seem to be able to find the correct path to your data file in the unit test and this is what this thread
is about, isn't it?I tried to parse the .prm file but still the unit test fail. And yes I am able to find the correct path to my data file but not able to run unit test with it.
Do you have a working setting (without the testsuite setup) for which you can treat your data file appropriately?
If this works, we can try to find out why it doesn't work using the testuite setting.Yes I have a working setting where I am able to read different data files for different .prm files and they work as expected for all.
ParameterHandler prm;
MyLovelyParameters::declare_parameters(prm);
// parameters
std::ostringstream oss;
oss << "set Something = 3" << std::endl
<< "set LAMMPS input = " << SOURCE_DIR << "/relative/path/to/input.xyz" << std::endl;
prm.parse_input_from_string(oss.str().c_str());
// use it to do the same as in main.cc
// (depends on how things are implemented)
On 12 Oct 2017, at 13:34, Denis Davydov <davy...@gmail.com> wrote:Vinayak,I don't think it's appropriate to request other developers to help you fix your unit test.I think both myself and Daniel explained that you need to use the preprocessor variable in your .cc unit tests.If you have problems getting it right, then it should be trivial to debug: you just check what you write as a path within your .cc file and comparethat to your directory structure. Do you point to the file which exists? Is it the right file?You can also run tests in verbose mode to help with this task: ctest -V -R "some/regex""Setting up testsuite in user projects" https://www.dealii.org/developer/index.html gives code snippets and explainshow to setup a user project into a library+executable.Note that everyone here in the forum helps others voluntarily. So it's a place to ask questions and seek for advice,but the place to ask others to solve your task for you.
--
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 a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/6YgunmMhva0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.