Hello Daniel, I have attached the test.cc (in my case gaussian-charges.cc) , .prm and .data input files. With this setup for test it fails.
Could you help? Regards, Vinayak Gholap On Friday, October 6, 2017 at 5:34:56 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. >> > So again: Are you calling read_input for the parameter file or the data > file? How does your setup actually look like? > Is it similar to the one I suggested above? > > >> >> 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. >> > Then, the code should be identical apart from putting SOURCE_DIR in the > places where you are reading the parameter file and the data file. > Is this the case? > > If this doesn't help, can you come up with a minimal example version of > the setup you are using? > > Best, > Daniel > >> > -- 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.
atom_2.data
Description: Binary data
#include "../tests.h" #include <deal.II/base/logstream.h> #include <deal.II/base/parameter_handler.h> #include <fstream> class ParameterReader: public Subscriptor { public: ParameterReader(ParameterHandler &); void read_parameters(const std::string &); private: void declare_parameters(); ParameterHandler &prm; }; ParameterReader::ParameterReader(ParameterHandler ¶mhandler) : prm(paramhandler) {} void ParameterReader::declare_parameters() { prm.enter_subsection("Geometry"); { prm.declare_entry("Number of global refinement","2",Patterns::Integer(), "The uniform global mesh refinement on the Domain in the power of 4"); prm.declare_entry("Domain limit left","-1",Patterns::Double(), "Left limit of domain"); prm.declare_entry("Domain limit right","1",Patterns::Double(), "Right limit of domain"); } prm.leave_subsection(); prm.enter_subsection("Problem Selection"); { prm.declare_entry ("Problem","Step16",Patterns::Selection("Step16 | GaussianCharges"), "Problem definition for RHS Function"); prm.declare_entry ("Dimension", "2", Patterns::Integer(), "Problem space dimension"); } prm.leave_subsection(); prm.enter_subsection("Misc"); { prm.declare_entry ("Number of Adaptive Refinement","2",Patterns::Integer(), "Number of Adaptive refinement cycles to be done"); prm.declare_entry ("smoothing length", "0.5", Patterns::Double(), "The smoothing length parameter for each Gaussian atom"); prm.declare_entry ("Nonzero Density radius parameter around each charge","3",Patterns::Double(), "Set the parameter to localize the density around each charge where it is nonzero"); } prm.leave_subsection(); prm.declare_entry("Polynomial degree", "1", Patterns::Integer(), "Polynomial degree of finite elements"); prm.enter_subsection("Solver input data"); { prm.declare_entry ("Preconditioner","GMG",Patterns::Selection("GMG | Jacobi"), "Preconditioner type to be applied to the system matrix"); } prm.leave_subsection(); prm.enter_subsection("Lammps data"); { prm.declare_entry ("Lammps input file","atom_8.data",Patterns::Anything(), "Lammps input file with atoms, charges and positions"); } prm.leave_subsection(); } void ParameterReader::read_parameters(const std::string ¶meter_file) { declare_parameters(); } void check (const char *p) { ParameterHandler prm; ParameterReader param(prm); std::ifstream in(p); param.read_parameters(in); param.parse_input(in); std::ostringstream oss; oss << "set Lammps input file = " << SOURCE_DIR << "/atom_2.data" << std::endl; param.parse_input_from_string(oss.str().c_str()); } int main () { std::ofstream logfile("output"); deallog.attach(logfile); deallog.threshold_double(1.e-10); check (SOURCE_DIR "/gaussian-charges.prm"); return 0; }
gaussian-charges.prm
Description: Binary data