# cee::vtfx::Database

class `Database` : public RefCountedObject

  A VTFx database.

  The class represents a database of data blocks.

  The blocks contain data such as node coordinates, finite elements, or result values - see *Block. A database requires a unique id per VTFx file. One (and only one) geometry block and state info block are required for each database.

  Public Types

  enum `SimulationType`

    Values:

    enumerator `SIMULATION_TYPE_STRUCTURAL`
    enumerator `SIMULATION_TYPE_THERMAL`
    enumerator `SIMULATION_TYPE_ELECTRIC`
    enumerator `SIMULATION_TYPE_MAGNETIC`
    enumerator `SIMULATION_TYPE_FLUID`
    enumerator `SIMULATION_TYPE_ACOUSTIC`
    enumerator `SIMULATION_TYPE_DIFFUSION`
    enumerator `SIMULATION_TYPE_OTHER`
  enum `SolutionType`

    Values:

    enumerator `SOLUTION_TYPE_STATIC`
    enumerator `SOLUTION_TYPE_STEADY_STATE`
    enumerator `SOLUTION_TYPE_VIBRATION`
    enumerator `SOLUTION_TYPE_BUCKLING`
    enumerator `SOLUTION_TYPE_TRANSIENT`
    enumerator `SOLUTION_TYPE_SUPERELEMENT`
    enumerator `SOLUTION_TYPE_FREQRESPONSE`
    enumerator `SOLUTION_TYPE_COMPLEXEIGEN`
    enumerator `SOLUTION_TYPE_QUASISTATIC`
    enumerator `SOLUTION_TYPE_OUTPUT`
    enumerator `SOLUTION_TYPE_SINGULAR`
    enumerator `SOLUTION_TYPE_OTHER`

  Public Functions

  `Database`(File *file, const Str &databaseName, int databaseId, SimulationType simulationType = SIMULATION_TYPE_OTHER, SolutionType solutionType = SOLUTION_TYPE_OTHER, const Str &description = "")

    Constructs a new database.

    The constructor takes the file instance as a parameter. The File will take ownership of the database and ensure that all belonging databases are written to file.

    Specify a database name and a database id. The database id needs to be unique within the file.

  virtual `~Database`()
  int `id`() const

    Returns the database id.

  Str `name`() const

    Returns the database name.

  bool `writeBlock`(const Block *block)

    Writes a block to the database.

    Returns false if there was an error writing the block to the file. Detailed info is available in the log.

  size_t `blockCount`(Block::BlockType blockType) const

    Returns the number of blocks of the given block type.

  PtrRef<Block> `blockByIndex`(Block::BlockType blockType, size_t blockIndex)

    Returns the block of the given block type with index blockIndex.

  PtrRef<Block> `blockById`(Block::BlockType blockType, int blockId)

    Returns the block of the given block type and that has the given block id.

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Envision for Desktop in your own language, or choose a sample question below to start a conversation:

What is HOOPS Envision for Desktop?
What are the latest release notes for HOOPS Envision for Desktop?
How do I start evaluating HOOPS Envision for Desktop?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...