|
| | Variable ()=default |
| | Construct a new Variables object.
|
| |
| | Variable (const philote::VariableType &type, const std::vector< size_t > &shape) |
| | Construct a new Variable object.
|
| |
| | Variable (const philote::VariableMetaData &meta) |
| | Construct a new Variable object.
|
| |
| | Variable (const philote::PartialsMetaData &meta) |
| | Construct a new Variable object.
|
| |
| | ~Variable () noexcept=default |
| | Destroy the Variables object.
|
| |
| void | Segment (const size_t &start, const size_t &end, const std::vector< double > &data) |
| | Assigns a segment of the array given a subvector.
|
| |
| std::vector< double > | Segment (const size_t &start, const size_t &end) const |
| | Retrieves a reference to a segment of the array given a subvector.
|
| |
| std::vector< size_t > | Shape () const noexcept |
| | Returns the shape of the array.
|
| |
| size_t | Size () const noexcept |
| | Returns the size of the array.
|
| |
| double | operator() (const size_t &i) const |
| | Returns the value of the array at a given index.
|
| |
| double & | operator() (const size_t &i) |
| | Returns the value of the array at a given index.
|
| |
| philote::Array | CreateChunk (const size_t &start, const size_t &end) const |
| | Create a Chunk of the variable.
|
| |
| void | Send (std::string name, std::string subname, grpc::ClientReaderWriter<::philote::Array, ::philote::Array > *stream, const size_t &chunk_size) const |
| | Sends the variable from the client to the server.
|
| |
| void | Send (std::string name, std::string subname, grpc::ServerReaderWriterInterface<::philote::Array, ::philote::Array > *stream, const size_t &chunk_size, grpc::ServerContext *context=nullptr) const |
| | Sends the variable from the server to the client using the interface.
|
| |
| void | Send (std::string name, std::string subname, grpc::ClientReaderWriterInterface<::philote::Array, ::philote::Array > *stream, const size_t &chunk_size) const |
| | Sends the variable from the client to the server using the interface.
|
| |
| void | AssignChunk (const Array &data) |
| | Assigns a chunk to the variable.
|
| |
A class for storing continuous and discrete variables.
The Variable class provides a container for multi-dimensional arrays used in Philote disciplines. Variables can represent inputs, outputs, or residuals and support operations like segmentation, streaming over gRPC, and element access.
- Example: Creating and Using Variables
for (size_t i = 0; i < 100; ++i) {
pressure(i) = 101325.0 + i * 10.0;
}
std::vector<size_t> shape = pressure.
Shape();
size_t total = pressure.Size();
double val = pressure(0);
A class for storing continuous and discrete variables.
Definition variable.h:85
std::vector< size_t > Shape() const noexcept
Returns the shape of the array.
- Example: Creating from Metadata
philote::VariableMetaData meta;
meta.set_name("temperature");
meta.add_shape(5);
meta.set_units("K");
meta.set_type(philote::kOutput);
temp(0) = 300.0;
- Note
- Thread Safety: This class is NOT thread-safe. Concurrent reads and writes to the same Variable instance will cause data races. If multiple threads need to access the same Variable, external synchronization is required. Each thread should preferably have its own Variable instances.