Hi everybody,
I'd like to extend the code for outputting (by the thermo_style custom) some information calculated in a fix called "fix_information.cpp" during the runs.
Now I get an error
Thermo.cpp:XXX: "expected primary-expression before '->' token"
and I hope you can explain me what I did wrong:
I include the following lines:
Changes in thermo.h
...
private:
void compute_info1;
Changes in thermo.cpp
// --------------------------------------------------------------------
Void Thermo::parse_fields(char *str)
{
// customize a new keyword by adding to if statement
...
else if (strcmp(word,"info1")==0 {
Addfield("info1",&Thermo::compute_info1,FLOAT);
}
...
}
// --------------------------------------------------------------------
Int Thermo::evaluate_keyword(char *word, double *answer)
...
else if (strcomp(word,"info1")==0) {
compute_info1();
}
...
}
// --------------------------------------------------------------------
Void Thermo::compute_info1()
{
Line XXX: dvalue = Information->info1;
}
Thanks a lot in advance,
Kind regards,
Sebastian
Hi
Obviously "Information" is not know to the thermo class. Its no member of it or no local variable in the routine compute_info1().
Cheers
Christian
-------- Original-Nachricht --------
Hi everybody,
I'd like to extend the code for outputting (by the thermo_style custom) some information calculated in a fix called "fix_information.cpp" during the runs.
Now I get an error
Thermo.cpp:XXX: "expected primary-expression before '->' token"
and I hope you can explain me what I did wrong:
I include the following lines:
Changes in thermo.h
...
private:
void compute_info1;
Changes in thermo.cpp
// --------------------------------------------------------------------
Void Thermo::parse_fields(char *str)
{
// customize a new keyword by adding to if statement
...
else if (strcmp(word,"info1")==0 {
Addfield("info1",&Thermo::compute_info1,FLOAT);
}
...
}
// --------------------------------------------------------------------
Int Thermo::evaluate_keyword(char *word, double *answer)
...
else if (strcomp(word,"info1")==0) {
compute_info1();
}
...
}
// --------------------------------------------------------------------
Void Thermo::compute_info1()
{
Line XXX: dvalue = Information->info1;
}
Thanks a lot in advance,
sebastian,
this is not the way how this kind of information is
typically passed around. no modification to the
thermo class should be needed.
a fix can return a scalar or vector property and those properties
can be accessed via the f_fixname or f_fixname[1] f_fixname[2]
conventions. please check out:
http://lammps.sandia.gov/doc/Section_howto.html#howto_15
axel.