Tissue Forge C++ 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
Loading...
Searching...
No Matches
tfStateVector.h
Go to the documentation of this file.
1/*******************************************************************************
2 * This file is part of Tissue Forge.
3 * Copyright (c) 2022-2024 T.J. Sego
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 ******************************************************************************/
19
24
25#ifndef _SOURCE_STATE_TFSTATEVECTOR_H_
26#define _SOURCE_STATE_TFSTATEVECTOR_H_
27
28#include <tf_port.h>
29#include <io/tf_io.h>
30#include <stdio.h>
31#include <string>
32
33#include "tfSpeciesList.h"
34
35
36namespace TissueForge {
37
38
39 namespace state {
40
41
42 enum StateVectorFlags {
43 STATEVECTOR_NONE = 0,
44 STATEVECTOR_OWNMEMORY = 1 << 0,
45 };
46
50 struct CAPI_EXPORT StateVector {
51 uint32_t flags;
52 uint32_t size;
53
58
64 void *owner;
65
66 void* data;
67
68 // vector of values
69 FloatP_t *fvec;
70
71 // vector of fluxes
72 FloatP_t *q;
73
74 // vector of species flags
75 uint32_t *species_flags;
76
77 // reset the species values based on the values specified in the species.
78 void reset();
79 const std::string str() const;
80
81 FloatP_t *item(const int &i);
82 void setItem(const int &i, const FloatP_t &val);
83
84 StateVector();
86 void *owner=NULL,
87 StateVector *existingStateVector=NULL,
88 uint32_t flags=STATEVECTOR_NONE,
89 void *data=NULL);
90 StateVector(const StateVector &other);
91 ~StateVector();
92
98 std::string toString();
99
106 static StateVector *fromString(const std::string &str);
107 };
108
109 }
110
111 namespace io {
112
113 template <>
114 HRESULT toFile(const TissueForge::state::StateVector &dataElement, const MetaData &metaData, IOElement &fileElement);
115
116 template <>
117 HRESULT fromFile(const IOElement &fileElement, const MetaData &metaData, TissueForge::state::StateVector **dataElement);
118
119 }
120
121};
122
123#endif // _SOURCE_STATE_TFSTATEVECTOR_H_
Tissue Forge I/O.
Definition tfThreeDFAngleMeshGenerator.h:28
HRESULT toFile(const T &dataElement, const MetaData &metaData, IOElement &fileElement)
Convert an object to an intermediate I/O object.
HRESULT fromFile(const IOElement &fileElement, const MetaData &metaData, T *dataElement)
Instantiate an object from an intermediate I/O object.
Tissue Forge state dynamics modeling features.
Definition tfSpecies.h:42
Include Python header, disable linking to pythonX_d.lib on Windows in debug mode.
Definition tfAngleConfig.h:26
Definition tfSpeciesList.h:37
A state vector of an object.
Definition tfStateVector.h:50
void * owner
Definition tfStateVector.h:64
static StateVector * fromString(const std::string &str)
Create from a JSON string representation.
std::string toString()
Get a JSON string representation.
struct TissueForge::state::SpeciesList * species
Species of the state vector.
Definition tfStateVector.h:57
int32_t HRESULT
Definition tf_port.h:255