@@ -15,7 +15,6 @@ int acRemoteForceInterface::Init () {
1515
1616int acRemoteForceInterface::ConnectRemoteForceInterface (std::string integrator_) {
1717 output (" Connecting RFI to %s\n " ,integrator_.c_str ());
18- pugi::xml_attribute attr;
1918 double units[3 ];
2019 units[0 ] = solver->units .alt (" 1m" );
2120 units[1 ] = solver->units .alt (" 1s" );
@@ -25,7 +24,6 @@ int acRemoteForceInterface::ConnectRemoteForceInterface(std::string integrator_)
2524 solver->lattice ->RFI .CanCopeWithUnits (false );
2625
2726 solver->lattice ->RFI .setVar (" output" , solver->info .outpath );
28-
2927
3028 std::string element_content;
3129 int node_children = 0 ;
@@ -44,24 +42,40 @@ int acRemoteForceInterface::ConnectRemoteForceInterface(std::string integrator_)
4442 }
4543 }
4644 if (node_children > 0 ) solver->lattice ->RFI .setVar (" content" , element_content);
45+
4746 bool stats = false ;
4847 std::string stats_prefix = solver->info .outpath ;
4948 stats_prefix = stats_prefix + " _RFI" ;
5049 int stats_iter = 200 ;
51-
52- attr = node.attribute (" stats" );
53- if (attr) stats = attr.as_bool ();
54- attr = node.attribute (" stats_iter" );
55- if (attr) {
56- stats_iter = solver->units .alt (attr.value ());
57- stats = true ;
58- }
59- attr = node.attribute (" stats_prefix" );
60- if (attr) {
61- stats_prefix = attr.value ();
62- stats = true ;
50+ bool use_box = true ;
51+
52+
53+ for (pugi::xml_attribute attr = node.first_attribute (); attr; attr = attr.next_attribute ()) {
54+ std::string attr_name = attr.name ();
55+ if (attr_name == " integrator" ) {
56+ // ignore
57+ } else if (attr_name == " stats" ) {
58+ stats = attr.as_bool ();
59+ } else if (attr_name == " stats_iter" ) {
60+ stats_iter = solver->units .alt (attr.value ());
61+ stats = true ;
62+ } else if (attr_name == " stats_prefix" ) {
63+ stats_prefix = attr.value ();
64+ stats = true ;
65+ } else if (attr_name == " use_box" ) {
66+ use_box = attr.as_bool ();
67+ } else if (attr_name == " omega" ) {
68+ solver->lattice ->RFI_omega = attr.as_bool ();
69+ } else if (attr_name == " torque" ) {
70+ solver->lattice ->RFI_torque = attr.as_bool ();
71+ } else {
72+ double val = solver->units .alt (attr.value ());
73+ char str[STRING_LEN];
74+ sprintf (str, " %.15lg" , val);
75+ solver->lattice ->RFI .setVar (attr.name (), str);
76+ }
6377 }
64-
78+
6579 if (stats) {
6680 output (" Asking for stats on RFI ( %s every %d it)\n " , stats_prefix.c_str (), stats_iter);
6781 solver->lattice ->RFI .enableStats (stats_prefix.c_str (), stats_iter);
@@ -74,10 +88,6 @@ int acRemoteForceInterface::ConnectRemoteForceInterface(std::string integrator_)
7488 }
7589 integrator = integrator_;
7690
77- bool use_box = true ;
78- attr = node.attribute (" use_box" );
79- if (attr) use_box = attr.as_bool ();
80-
8191 if (use_box) {
8292 lbRegion reg = solver->lattice ->region ;
8393 double px = solver->lattice ->px ;
@@ -92,15 +102,10 @@ int acRemoteForceInterface::ConnectRemoteForceInterface(std::string integrator_)
92102 pz + reg.dz + reg.nz + PART_MAR_BOX);
93103 }
94104
95- attr = node.attribute (" omega" );
96- if (attr) solver->lattice ->RFI_omega = attr.as_bool ();
97- attr = node.attribute (" torque" );
98- if (attr) solver->lattice ->RFI_torque = attr.as_bool ();
99-
100105 MPI_Barrier (MPMD.local );
101106 solver->lattice ->RFI .Connect (MPMD.work ,inter.work );
102107
103- return 0 ;
108+ return 0 ;
104109}
105110
106111
0 commit comments