Cogs.Core
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Cogs::Core::MultiphaseFlowComponent Class Reference
Inheritance diagram for Cogs::Core::MultiphaseFlowComponent:
Cogs::Core::DynamicComponent Cogs::ComponentModel::Component

Classes

struct  ControlPoint
 
struct  FlowFractionData
 
struct  TrajectoryPoint
 
struct  Vertex
 
struct  WallVertex
 

Public Member Functions

void updateFontSize ()
 
void initialize (Context *context)
 
void update ()
 
- Public Member Functions inherited from Cogs::ComponentModel::Component
class EntitygetContainer () const
 Get the container currently owning this component instance.
 
void setContainer (class Entity *container)
 Set the container owning this component instance.
 
template<typename ComponentType >
ComponentType * getComponent () const
 
COGSFOUNDATION_API ComponentgetComponent (const Reflection::Name &name) const
 
COGSFOUNDATION_API ComponentgetComponent (const Reflection::TypeId &id) const
 
template<typename ComponentType >
ComponentHandle getComponentHandle () const
 
COGSFOUNDATION_API ComponentHandle getComponentHandle (const Reflection::Name &name) const
 
COGSFOUNDATION_API ComponentHandle getComponentHandle (const Reflection::TypeId &id) const
 
void setActive ()
 Sets the component to the ComponentFlags::Active state.
 
bool isActive () const
 Gets if the component is currently set to the ComponentFlags::Active state.
 
void setChanged ()
 Sets the component to the ComponentFlags::Changed state with carry.
 
void setChangedTransient ()
 Sets the component to the ComponentFlags::Changed state without carry.
 
void setFieldChanged (const Reflection::FieldId fieldId)
 Sets the component to the ComponentFlags::Changed state without carry.
 
template<typename ClassType , typename FieldType >
void setFieldChanged (FieldType ClassType::*field)
 Sets a flag indicating that the given field has changed.
 
void setFieldChangedTransient (const Reflection::FieldId fieldId)
 Sets the component to the ComponentFlags::Changed state without carry.
 
bool hasChanged () const
 
bool hasAnyfieldChanged () const
 Gets if any fields have been changed.
 
bool hasFieldChanged (const Reflection::FieldId fieldId) const
 Gets if the field with the given id on this component instance has changed.
 
template<typename ClassType , typename FieldType >
bool hasFieldChanged (FieldType ClassType::*field) const
 Gets if the given field has changed.
 
void resetCarryChanged ()
 Reset the CarryChanged flag. Called at start of redraw. See ComponentFlags::CarryChanged.
 
void resetChanged ()
 Resets the changed state of the component, respecting any carry state set.
 
template<typename ClassType , typename FieldType >
Reflection::FieldId getFieldId (FieldType ClassType::*field) const
 Gets field ID of the given field.
 
void resetFieldsChanged ()
 Resets the state of all changed field flags.
 
void resetFieldChanged (const Reflection::FieldId fieldId)
 Resets the changed state of the given fieldId.
 
template<typename ClassType , typename FieldType >
void resetFieldChanged (FieldType ClassType::*field)
 Resets the changed state of the given field.
 
constexpr void setFlags (const uint32_t flags)
 Override all flags of the Component, setting the given flags.
 
constexpr void setFlag (const uint32_t flag)
 Set the given flags. Does not override the currently set flags.
 
constexpr void unsetFlag (const uint32_t flag)
 Unset the given flag. Does not remove the status of other than the given flags.
 
constexpr bool isSet (const uint32_t flag) const
 Checks if the given flag is set. Requires exact bit match if test of several bits.
 
constexpr void setTypeId (const Reflection::TypeId typeId)
 Set the Reflection::TypeId of the component.
 
constexpr Reflection::TypeId getTypeId () const
 Get the Reflection::TypeId of the component.
 
COGSFOUNDATION_API const Reflection::TypegetType () const
 Get the full Reflection::Type of the component.
 
constexpr void setIndex (const ComponentIndex index)
 Set the components pool index. For internal use only.
 
constexpr ComponentIndex getIndex () const
 Get the components pool index. For internal use only.
 
constexpr void setGeneration (uint16_t generation)
 Sets the component generation.
 
constexpr uint16_t getGeneration () const
 Gets the component generation.
 
size_t hash (size_t hashValue=Cogs::hash()) const
 Calculates a hash of this component's members.
 

Static Public Member Functions

static void registerType ()
 
- Static Public Member Functions inherited from Cogs::Core::DynamicComponent
static COGSCORE_DLL_API void registerType ()
 Register the type in the type system.
 
template<typename T >
static Reflection::TyperegisterDerivedType ()
 Convenience method for registering the type of a derived component.
 
- Static Public Member Functions inherited from Cogs::ComponentModel::Component
static COGSFOUNDATION_API void registerType ()
 Register the Component type in the global type database.
 
static COGSFOUNDATION_API Reflection::TypeId getComponentTypeId (const StringView &name)
 Get the type id of the component type with the given name.
 

Public Attributes

std::vector< glm::vec3 > trajectoryPoints
 
std::vector< float > radius
 
std::vector< glm::vec3 > flowFraction
 
std::vector< float > wallValues
 
float heightScale = 1.f
 
float radiusScale = 1.f
 
bool showWater = true
 
bool showOil = true
 
bool showGas = true
 
float unitScale = 1.f
 
std::string unitText = "m"
 
bool updateNeeded = true
 
glm::vec3 waterColor
 
glm::vec3 oilColor
 
glm::vec3 gasColor
 
float fontSize = 20.f
 
bool showAxialExtents = true
 
bool showShadow = true
 
bool showGrid = true
 
bool centerMesh = true
 
bool showIndicatorRing = false
 
float indicatorRingPosition = 0.f
 
glm::vec3 indicatorRingColor
 
- Public Attributes inherited from Cogs::Core::DynamicComponent
void * messageCallback = nullptr
 
void * userData = nullptr
 
size_t dynamicTypeInfoIndex = static_cast<size_t>(-1)
 

Private Types

enum  MeshType {
  StratifiedWater , AnnularWater , StratifiedOil , AnnularOil ,
  StratifiedGas , AnnularGas , Wall , Shadow ,
  First = 0 , Last = 7
}
 
enum  AnnotationAxis {
  X , YMin , YMax , Y ,
  Z , AxisFirst = X , AxisLast = Z
}
 

Private Member Functions

void createMeshEntity (EntityPtr &mesh, MeshType liquidType)
 
void updateMaterial (EntityPtr mesh, MeshType liquidType)
 
void generateMultiphaseFlowMesh (Mesh *mesh, const std::vector< ControlPoint > &controlPoints, MeshType liquidType)
 
void createGridEntity ()
 
void createTextEntity ()
 
void createIndicatorRing ()
 
void updateGroundGrid ()
 
void updateAxisAnnotations ()
 
void updateIndicatorRing (const std::vector< TrajectoryPoint > &trajectory)
 
void generateExtrusionVertices (std::vector< Vertex > &vertexBuffer, std::vector< unsigned int > &indexBuffer, const std::vector< ControlPoint > &controlPoints, MeshType liquidType)
 
void generateExtrusionVerticesWall (std::vector< WallVertex > &vertexBuffer, std::vector< unsigned int > &indexBuffer, const std::vector< ControlPoint > &controlPoints, MeshType liquidType)
 
void generateClosingCaps (std::vector< Vertex > &vertexBuffer, std::vector< unsigned int > &indexBuffer, const ControlPoint &controlPoint, MeshType liquidType)
 
void transformCrossection (float ratio, float alpha, std::vector< Vertex > &vertexBuffer, const ControlPoint &controlPoint, MeshType liquidType, bool isClosingCap=false)
 
void removeDuplicatedPoints (std::vector< TrajectoryPoint > &points)
 
void applyScaling (std::vector< TrajectoryPoint > &points)
 
void center (std::vector< TrajectoryPoint > &points)
 
void updateMeshes ()
 
void updateShadowVisibility ()
 
void finalizeControlPoints (std::vector< ControlPoint > &controlPoints)
 

Static Private Member Functions

static bool isStratified (MeshType liquidType)
 
static bool isAnnular (MeshType liquidType)
 
static unsigned int getNumOfSegmentsInCrossSection (MeshType liquidType)
 
static glm::vec3 wallValueToColor (const ControlPoint &controlPoint)
 
static void calculateNormals (std::vector< Vertex > &vertexBuffer, std::vector< unsigned int > &indexBuffer)
 

Private Attributes

Contextcontext = nullptr
 
MaterialmainMaterial = nullptr
 
VariableKey diffuseColorMaterialPropertyKey
 
VariableKey emissiveColorMaterialPropertyKey
 
VariableKey specularColorMaterialPropertyKey
 
EntityPtr meshEntity [MeshType::Last+1]
 
EntityPtr wallEntity
 
EntityPtr groundGridMeshEntity
 
EntityPtr annotationAxisMeshEntity
 
EntityPtr indicatorRingEntity
 
EntityPtr textEntity [AnnotationAxis::AxisLast+1]
 
glm::vec3 geometryMin
 
glm::vec3 geometryMax
 
glm::vec3 scaledTrajectoryMin
 
glm::vec3 scaledTrajectoryMax
 
float currentFontSize = -1.f
 
bool currentShowAxialExtents = true
 
bool currentShowGrid = true
 
bool currentCenterMesh = true
 
bool currentShowIndicatorRing = false
 

Detailed Description

Definition at line 17 of file MultiphaseFlowComponent.h.

Member Enumeration Documentation

◆ AnnotationAxis

enum Cogs::Core::MultiphaseFlowComponent::AnnotationAxis
private

Definition at line 183 of file MultiphaseFlowComponent.h.

◆ MeshType

enum Cogs::Core::MultiphaseFlowComponent::MeshType
private

Definition at line 126 of file MultiphaseFlowComponent.h.

Constructor & Destructor Documentation

◆ MultiphaseFlowComponent()

MultiphaseFlowComponent::MultiphaseFlowComponent ( )

Definition at line 52 of file MultiphaseFlowComponent.cpp.

Member Function Documentation

◆ applyScaling()

void MultiphaseFlowComponent::applyScaling ( std::vector< TrajectoryPoint > &  points)
private

Definition at line 1534 of file MultiphaseFlowComponent.cpp.

◆ calculateNormals()

void MultiphaseFlowComponent::calculateNormals ( std::vector< Vertex > &  vertexBuffer,
std::vector< unsigned int > &  indexBuffer 
)
staticprivate

Definition at line 1973 of file MultiphaseFlowComponent.cpp.

◆ center()

void MultiphaseFlowComponent::center ( std::vector< TrajectoryPoint > &  points)
private

Definition at line 1555 of file MultiphaseFlowComponent.cpp.

◆ createGridEntity()

void MultiphaseFlowComponent::createGridEntity ( )
private

Definition at line 248 of file MultiphaseFlowComponent.cpp.

◆ createIndicatorRing()

void MultiphaseFlowComponent::createIndicatorRing ( )
private

Definition at line 267 of file MultiphaseFlowComponent.cpp.

◆ createMeshEntity()

void MultiphaseFlowComponent::createMeshEntity ( EntityPtr mesh,
MeshType  liquidType 
)
private

Definition at line 127 of file MultiphaseFlowComponent.cpp.

◆ createTextEntity()

void MultiphaseFlowComponent::createTextEntity ( )
private

Definition at line 280 of file MultiphaseFlowComponent.cpp.

◆ finalizeControlPoints()

void MultiphaseFlowComponent::finalizeControlPoints ( std::vector< ControlPoint > &  controlPoints)
private

Definition at line 1599 of file MultiphaseFlowComponent.cpp.

◆ generateClosingCaps()

void MultiphaseFlowComponent::generateClosingCaps ( std::vector< Vertex > &  vertexBuffer,
std::vector< unsigned int > &  indexBuffer,
const ControlPoint controlPoint,
MeshType  liquidType 
)
private

Definition at line 736 of file MultiphaseFlowComponent.cpp.

◆ generateExtrusionVertices()

void MultiphaseFlowComponent::generateExtrusionVertices ( std::vector< Vertex > &  vertexBuffer,
std::vector< unsigned int > &  indexBuffer,
const std::vector< ControlPoint > &  controlPoints,
MeshType  liquidType 
)
private

Definition at line 560 of file MultiphaseFlowComponent.cpp.

◆ generateExtrusionVerticesWall()

void MultiphaseFlowComponent::generateExtrusionVerticesWall ( std::vector< WallVertex > &  vertexBuffer,
std::vector< unsigned int > &  indexBuffer,
const std::vector< ControlPoint > &  controlPoints,
MeshType  liquidType 
)
private

Definition at line 843 of file MultiphaseFlowComponent.cpp.

◆ generateMultiphaseFlowMesh()

void MultiphaseFlowComponent::generateMultiphaseFlowMesh ( Mesh mesh,
const std::vector< ControlPoint > &  controlPoints,
MeshType  liquidType 
)
private

Definition at line 944 of file MultiphaseFlowComponent.cpp.

◆ getNumOfSegmentsInCrossSection()

unsigned int MultiphaseFlowComponent::getNumOfSegmentsInCrossSection ( MeshType  liquidType)
staticprivate

Definition at line 122 of file MultiphaseFlowComponent.cpp.

◆ initialize()

void MultiphaseFlowComponent::initialize ( Context context)

Definition at line 202 of file MultiphaseFlowComponent.cpp.

◆ isAnnular()

bool MultiphaseFlowComponent::isAnnular ( MeshType  liquidType)
staticprivate

Definition at line 115 of file MultiphaseFlowComponent.cpp.

◆ isStratified()

bool MultiphaseFlowComponent::isStratified ( MeshType  liquidType)
staticprivate

Definition at line 106 of file MultiphaseFlowComponent.cpp.

◆ registerType()

void MultiphaseFlowComponent::registerType ( )
static

Definition at line 71 of file MultiphaseFlowComponent.cpp.

◆ removeDuplicatedPoints()

void MultiphaseFlowComponent::removeDuplicatedPoints ( std::vector< TrajectoryPoint > &  points)
private

Definition at line 1516 of file MultiphaseFlowComponent.cpp.

◆ transformCrossection()

void MultiphaseFlowComponent::transformCrossection ( float  ratio,
float  alpha,
std::vector< Vertex > &  vertexBuffer,
const ControlPoint controlPoint,
MeshType  liquidType,
bool  isClosingCap = false 
)
private

Definition at line 385 of file MultiphaseFlowComponent.cpp.

◆ update()

void MultiphaseFlowComponent::update ( )

Definition at line 1925 of file MultiphaseFlowComponent.cpp.

◆ updateAxisAnnotations()

void MultiphaseFlowComponent::updateAxisAnnotations ( )
private

Definition at line 1345 of file MultiphaseFlowComponent.cpp.

◆ updateFontSize()

void MultiphaseFlowComponent::updateFontSize ( )

Definition at line 295 of file MultiphaseFlowComponent.cpp.

◆ updateGroundGrid()

void MultiphaseFlowComponent::updateGroundGrid ( )
private

Definition at line 1213 of file MultiphaseFlowComponent.cpp.

◆ updateIndicatorRing()

void MultiphaseFlowComponent::updateIndicatorRing ( const std::vector< TrajectoryPoint > &  trajectory)
private

Definition at line 1269 of file MultiphaseFlowComponent.cpp.

◆ updateMaterial()

void MultiphaseFlowComponent::updateMaterial ( EntityPtr  mesh,
MeshType  liquidType 
)
private

Definition at line 144 of file MultiphaseFlowComponent.cpp.

◆ updateMeshes()

void MultiphaseFlowComponent::updateMeshes ( )
private

Definition at line 1713 of file MultiphaseFlowComponent.cpp.

◆ updateShadowVisibility()

void MultiphaseFlowComponent::updateShadowVisibility ( )
private

Definition at line 1696 of file MultiphaseFlowComponent.cpp.

◆ wallValueToColor()

glm::vec3 MultiphaseFlowComponent::wallValueToColor ( const ControlPoint controlPoint)
staticprivate

Definition at line 377 of file MultiphaseFlowComponent.cpp.

Member Data Documentation

◆ annotationAxisMeshEntity

EntityPtr Cogs::Core::MultiphaseFlowComponent::annotationAxisMeshEntity
private

Definition at line 203 of file MultiphaseFlowComponent.h.

◆ centerMesh

bool Cogs::Core::MultiphaseFlowComponent::centerMesh = true

Definition at line 39 of file MultiphaseFlowComponent.h.

◆ context

Context* Cogs::Core::MultiphaseFlowComponent::context = nullptr
private

Definition at line 195 of file MultiphaseFlowComponent.h.

◆ currentCenterMesh

bool Cogs::Core::MultiphaseFlowComponent::currentCenterMesh = true
private

Definition at line 218 of file MultiphaseFlowComponent.h.

◆ currentFontSize

float Cogs::Core::MultiphaseFlowComponent::currentFontSize = -1.f
private

Definition at line 214 of file MultiphaseFlowComponent.h.

◆ currentShowAxialExtents

bool Cogs::Core::MultiphaseFlowComponent::currentShowAxialExtents = true
private

Definition at line 216 of file MultiphaseFlowComponent.h.

◆ currentShowGrid

bool Cogs::Core::MultiphaseFlowComponent::currentShowGrid = true
private

Definition at line 217 of file MultiphaseFlowComponent.h.

◆ currentShowIndicatorRing

bool Cogs::Core::MultiphaseFlowComponent::currentShowIndicatorRing = false
private

Definition at line 219 of file MultiphaseFlowComponent.h.

◆ diffuseColorMaterialPropertyKey

VariableKey Cogs::Core::MultiphaseFlowComponent::diffuseColorMaterialPropertyKey
private

Definition at line 197 of file MultiphaseFlowComponent.h.

◆ emissiveColorMaterialPropertyKey

VariableKey Cogs::Core::MultiphaseFlowComponent::emissiveColorMaterialPropertyKey
private

Definition at line 198 of file MultiphaseFlowComponent.h.

◆ flowFraction

std::vector<glm::vec3> Cogs::Core::MultiphaseFlowComponent::flowFraction

Definition at line 22 of file MultiphaseFlowComponent.h.

◆ fontSize

float Cogs::Core::MultiphaseFlowComponent::fontSize = 20.f

Definition at line 35 of file MultiphaseFlowComponent.h.

◆ gasColor

glm::vec3 Cogs::Core::MultiphaseFlowComponent::gasColor

Definition at line 34 of file MultiphaseFlowComponent.h.

◆ geometryMax

glm::vec3 Cogs::Core::MultiphaseFlowComponent::geometryMax
private

Definition at line 209 of file MultiphaseFlowComponent.h.

◆ geometryMin

glm::vec3 Cogs::Core::MultiphaseFlowComponent::geometryMin
private

Definition at line 208 of file MultiphaseFlowComponent.h.

◆ groundGridMeshEntity

EntityPtr Cogs::Core::MultiphaseFlowComponent::groundGridMeshEntity
private

Definition at line 202 of file MultiphaseFlowComponent.h.

◆ heightScale

float Cogs::Core::MultiphaseFlowComponent::heightScale = 1.f

Definition at line 24 of file MultiphaseFlowComponent.h.

◆ indicatorRingColor

glm::vec3 Cogs::Core::MultiphaseFlowComponent::indicatorRingColor

Definition at line 42 of file MultiphaseFlowComponent.h.

◆ indicatorRingEntity

EntityPtr Cogs::Core::MultiphaseFlowComponent::indicatorRingEntity
private

Definition at line 204 of file MultiphaseFlowComponent.h.

◆ indicatorRingPosition

float Cogs::Core::MultiphaseFlowComponent::indicatorRingPosition = 0.f

Definition at line 41 of file MultiphaseFlowComponent.h.

◆ mainMaterial

Material* Cogs::Core::MultiphaseFlowComponent::mainMaterial = nullptr
private

Definition at line 196 of file MultiphaseFlowComponent.h.

◆ meshEntity

EntityPtr Cogs::Core::MultiphaseFlowComponent::meshEntity[MeshType::Last+1]
private

Definition at line 200 of file MultiphaseFlowComponent.h.

◆ oilColor

glm::vec3 Cogs::Core::MultiphaseFlowComponent::oilColor

Definition at line 33 of file MultiphaseFlowComponent.h.

◆ radius

std::vector<float> Cogs::Core::MultiphaseFlowComponent::radius

Definition at line 21 of file MultiphaseFlowComponent.h.

◆ radiusScale

float Cogs::Core::MultiphaseFlowComponent::radiusScale = 1.f

Definition at line 25 of file MultiphaseFlowComponent.h.

◆ scaledTrajectoryMax

glm::vec3 Cogs::Core::MultiphaseFlowComponent::scaledTrajectoryMax
private

Definition at line 212 of file MultiphaseFlowComponent.h.

◆ scaledTrajectoryMin

glm::vec3 Cogs::Core::MultiphaseFlowComponent::scaledTrajectoryMin
private

Definition at line 211 of file MultiphaseFlowComponent.h.

◆ showAxialExtents

bool Cogs::Core::MultiphaseFlowComponent::showAxialExtents = true

Definition at line 36 of file MultiphaseFlowComponent.h.

◆ showGas

bool Cogs::Core::MultiphaseFlowComponent::showGas = true

Definition at line 28 of file MultiphaseFlowComponent.h.

◆ showGrid

bool Cogs::Core::MultiphaseFlowComponent::showGrid = true

Definition at line 38 of file MultiphaseFlowComponent.h.

◆ showIndicatorRing

bool Cogs::Core::MultiphaseFlowComponent::showIndicatorRing = false

Definition at line 40 of file MultiphaseFlowComponent.h.

◆ showOil

bool Cogs::Core::MultiphaseFlowComponent::showOil = true

Definition at line 27 of file MultiphaseFlowComponent.h.

◆ showShadow

bool Cogs::Core::MultiphaseFlowComponent::showShadow = true

Definition at line 37 of file MultiphaseFlowComponent.h.

◆ showWater

bool Cogs::Core::MultiphaseFlowComponent::showWater = true

Definition at line 26 of file MultiphaseFlowComponent.h.

◆ specularColorMaterialPropertyKey

VariableKey Cogs::Core::MultiphaseFlowComponent::specularColorMaterialPropertyKey
private

Definition at line 199 of file MultiphaseFlowComponent.h.

◆ textEntity

EntityPtr Cogs::Core::MultiphaseFlowComponent::textEntity[AnnotationAxis::AxisLast+1]
private

Definition at line 206 of file MultiphaseFlowComponent.h.

◆ trajectoryPoints

std::vector<glm::vec3> Cogs::Core::MultiphaseFlowComponent::trajectoryPoints

Definition at line 20 of file MultiphaseFlowComponent.h.

◆ unitScale

float Cogs::Core::MultiphaseFlowComponent::unitScale = 1.f

Definition at line 29 of file MultiphaseFlowComponent.h.

◆ unitText

std::string Cogs::Core::MultiphaseFlowComponent::unitText = "m"

Definition at line 30 of file MultiphaseFlowComponent.h.

◆ updateNeeded

bool Cogs::Core::MultiphaseFlowComponent::updateNeeded = true

Definition at line 31 of file MultiphaseFlowComponent.h.

◆ wallEntity

EntityPtr Cogs::Core::MultiphaseFlowComponent::wallEntity
private

Definition at line 201 of file MultiphaseFlowComponent.h.

◆ wallValues

std::vector<float> Cogs::Core::MultiphaseFlowComponent::wallValues

Definition at line 23 of file MultiphaseFlowComponent.h.

◆ waterColor

glm::vec3 Cogs::Core::MultiphaseFlowComponent::waterColor

Definition at line 32 of file MultiphaseFlowComponent.h.


The documentation for this class was generated from the following files: