Skip to content

Commit 2e66c2e

Browse files
committed
Moved the explicit specializations of writeInGraph in Custom.cpp
1 parent ee2a2dc commit 2e66c2e

5 files changed

Lines changed: 24 additions & 44 deletions

File tree

src/cltools/ShowGraph.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ int ShowGraph::main(FILE* in, FILE*out,Communicator& pc) {
338338
if( a->getName()=="DOMAIN_DECOMPOSITION" || a->getLabel()=="posx" || a->getLabel()=="posy" || a->getLabel()=="posz" || a->getLabel()=="Masses" || a->getLabel()=="Charges" ) {
339339
continue;
340340
}
341-
ActionToPutData* ap=dynamic_cast<ActionToPutData*>(a);
341+
ActionToPutData* ap=a->castToActionToPutData();
342342
if( ap ) {
343343
ofile.printf("%s(\"label=%s \n %s \n\")\n", getLabel(a).c_str(), getLabel(a,true).c_str(), a->writeInGraph().c_str() );
344344
continue;
@@ -347,12 +347,13 @@ int ShowGraph::main(FILE* in, FILE*out,Communicator& pc) {
347347
if( as ) {
348348
continue ;
349349
}
350-
ActionWithValue* av=dynamic_cast<ActionWithValue*>(a);
351-
ActionWithArguments* aaa=dynamic_cast<ActionWithArguments*>(a);
352-
ActionAtomistic* at=dynamic_cast<ActionAtomistic*>(a);
350+
353351
// Print out the connections between nodes
352+
ActionAtomistic* at=a->castToActionAtomistic();
354353
printAtomConnections( at, linkcount, false, ofile );
354+
ActionWithArguments* aaa=a->castToActionWithArguments();
355355
printArgumentConnections( aaa, linkcount, false, ofile );
356+
ActionWithValue* av=a->castToActionWithValue();
356357
// Print out the nodes
357358
if( !av ) {
358359
ofile.printf("%s(\"label=%s \n %s \n\")\n", getLabel(a).c_str(), getLabel(a,true).c_str(), a->writeInGraph().c_str() );

src/function/Custom.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,25 @@ Calculate an arbitrary function piecewise for one or multiple input matrices.
475475
*/
476476
//+ENDPLUMEDOC
477477

478+
template <>
479+
std::string FunctionOfScalar<Custom>::writeInGraph() const {
480+
std::size_t und = getName().find_last_of("_");
481+
std::cerr <<"FunctionOfScalar<Custom>::writeInGraph()\n";
482+
return getName().substr(0,und) + "\nFUNC=" + myfunc.func;
483+
}
484+
485+
template <>
486+
std::string FunctionOfVector<Custom>::writeInGraph() const {
487+
std::size_t und = getName().find_last_of("_");
488+
return getName().substr(0,und) + "\nFUNC=" + taskmanager.getActionInput().f.func;
489+
}
490+
491+
template <>
492+
std::string FunctionOfMatrix<Custom>::writeInGraph() const {
493+
std::size_t und = getName().find_last_of("_");
494+
return getName().substr(0,und) + "\nFUNC=" + taskmanager.getActionInput().f.func;
495+
}
496+
478497
typedef FunctionShortcut<Custom> CustomShortcut;
479498
PLUMED_REGISTER_ACTION(CustomShortcut,"CUSTOM")
480499
PLUMED_REGISTER_ACTION(CustomShortcut,"MATHEVAL")

src/function/FunctionOfMatrix.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,3 @@
2020
along with plumed. If not, see <http://www.gnu.org/licenses/>.
2121
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
2222
#include "FunctionOfMatrix.h"
23-
#include "Custom.h"
24-
25-
namespace PLMD {
26-
namespace function {
27-
28-
template <>
29-
std::string FunctionOfMatrix<Custom>::writeInGraph() const {
30-
std::size_t und = getName().find_last_of("_");
31-
return getName().substr(0,und) + "\nFUNC=" + taskmanager.getActionInput().f.func;
32-
}
33-
34-
}
35-
}

src/function/FunctionOfScalar.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,3 @@
2020
along with plumed. If not, see <http://www.gnu.org/licenses/>.
2121
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
2222
#include "FunctionOfScalar.h"
23-
#include "Custom.h"
24-
25-
namespace PLMD {
26-
namespace function {
27-
28-
template <>
29-
std::string FunctionOfScalar<Custom>::writeInGraph() const {
30-
std::size_t und = getName().find_last_of("_");
31-
return getName().substr(0,und) + "\nFUNC=" + myfunc.func;
32-
}
33-
34-
}
35-
}
36-

src/function/FunctionOfVector.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,3 @@
2020
along with plumed. If not, see <http://www.gnu.org/licenses/>.
2121
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
2222
#include "FunctionOfVector.h"
23-
#include "Custom.h"
24-
25-
namespace PLMD {
26-
namespace function {
27-
28-
template <>
29-
std::string FunctionOfVector<Custom>::writeInGraph() const {
30-
std::size_t und = getName().find_last_of("_");
31-
return getName().substr(0,und) + "\nFUNC=" + taskmanager.getActionInput().f.func;
32-
}
33-
34-
}
35-
}

0 commit comments

Comments
 (0)