Vinayak,

You are mixing several things, it seems.
What you should do in your unit test is something along the lines:
      
      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)

Obviously, you need to adjust this code to what you are actually doing.

The point is, dealII have functionality to run user tests in two ways:
1) take the main executable and pass .rpm file as an argument
This won't work when you need some auxiliary data which is a part of the 
test.
That is because you don't know the path from which the test will be 
executed.

2) compile .cc file and run it. In this case, you should populate whatever 
parameter 
within that .cc file. But this also requires that you separate your program 
into a library (say with a single class Problem) and
executable main.cc which actually creates an instance of that class and 
runs it.
So what you do here is essentially the same thing as your main.cc but you 
feed parameters NOT from the command line argument,
but create them yourself dynamically (SOURCE_DIR will be dynamic macro 
depending on where you actually configure/build).

Regards,
Denis

On Friday, October 6, 2017 at 4:18:24 PM UTC+2, Vinayak Gholap wrote:
>
> Hello Daniel,
>
> On Friday, October 6, 2017 at 3:09:33 PM UTC+2, Daniel Arndt wrote:
>>
>> 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?
>>
>> 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.
>
> Regards,
> Vinayak Gholap
>
>>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to