From b199368c19bdc5f1b5f0fc991473ae7de3f73d31 Mon Sep 17 00:00:00 2001 From: Shern Tee Date: Thu, 14 Dec 2023 10:46:32 +1000 Subject: [PATCH] add extract function to fix_property_atom --- src/fix_property_atom.cpp | 24 ++++++++++++++++++++++++ src/fix_property_atom.h | 1 + 2 files changed, 25 insertions(+) diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 9613523059..1e004ae4cb 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -948,3 +948,27 @@ int FixPropertyAtom::size_restart(int /*nlocal*/) { return values_peratom + 1; } + +/* ---------------------------------------------------------------------- + extract fix property/atom properties +------------------------------------------------------------------------- */ + +void *FixPropertyAtom::extract(const char *str, int &dim) +{ + dim=0; + if (strcmp(str, "nvalue") == 0) { + return &nvalue; + } else if (strcmp(str, "border") == 0) { + return &border; + } + dim=1; + if (strcmp(str, "styles") == 0) { + return &styles; + } else if (strcmp(str, "index") == 0) { + return &index; + } else if (strcmp(str, "cols") == 0) { + return &cols; + } + return nullptr; +} + diff --git a/src/fix_property_atom.h b/src/fix_property_atom.h index c50b6049dc..820acf3a20 100644 --- a/src/fix_property_atom.h +++ b/src/fix_property_atom.h @@ -51,6 +51,7 @@ class FixPropertyAtom : public Fix { void unpack_restart(int, int) override; int size_restart(int) override; int maxsize_restart() override; + void *extract(const char *, int &) override; double memory_usage() override; protected: