jvx.vector
Class PwHodge
- java.lang.Object
-
- jv.object.PsObject
-
- jvx.project.PjWorkshop
-
- jvx.vector.PwHodge
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, PsUpdateIf, PjWorkshopIf
public class PwHodge extends PjWorkshop
Study Hodge decomposition of discrete vector fields. A vector field is split in gradient and rotation free parts with a remaining harmonic component.- See Also:
- Serialized Form
- Author:
- Konrad Polthier, Eike Preuss
- Version:
- 27.10.12, 4.00 revised (kp) Full revision of 2d case.
07.10.07, 3.50 revised (kp) Full revision of update mechanism and optimization.
09.12.06, 3.00 revised (kp) Moved to jvx.vector from jvx.geom.
06.05.03, 2.80 revised (ep) Beta methods for computing rotational features.
19.06.02, 2.70 revised (ep) Added methodgetZExtrema.
28.01.02, 2.60 revised (ep) New workshop classes and internationalization.
28.05.01, 2.50 revised (ep) Get displays WITH FRAME from viewer, initialize 0-gradient properties at begin.
17.05.01, 2.40 revised (ep) 5 displays to 3 displays, corrected update of minimizers.
11.12.00, 2.30 revised (ep) Made displays available to other classes.
10.12.00, 2.20 revised (ep) May change zero bounds condition for U and W separately.
06.06.00, 2.10 revised (ep) Moved to separate workshop.
06.03.00, 2.00 revised (ep) Corrected updates and made various changes.
24.11.99, 1.00 created (kp).
-
-
Field Summary
Fields Modifier and Type Field and Description static intDETECT_SADDLESstatic intDETECT_SINKS_SOURCESstatic intDETECT_VORTICES-
Fields inherited from class jv.object.PsObject
HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
-
Fields inherited from interface jv.project.PjWorkshopIf
MODE_BUG, MODE_STANDARD, MODE_VALIDATE
-
-
Constructor Summary
Constructors Constructor and Description PwHodge()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclose()Removes geometry and displays from workshop, and closes super workshop.voiddecompose()Initiates minimization of the two energies that produce the three parts of the decomposition.intgetDetectionFlags()Compare the DETECT_... constants.PvDisplayIfgetDisplay(int dispIndex)Returns one of the three displays: rotation-free, divergence-free and harmonic component and their features.PgVectorFieldgetDivergenceFree()Call methodminimize()before using this method.PgVectorFieldgetHarmonic()Call methodminimize()before using this method.PgElementSetgetPotentialU()Call methodminimize()before using this method.PgElementSetgetPotentialW()Call methodminimize()before using this method.PgVectorFieldgetRotationFree()Call methodminimize()before using this method.PgSurfaceGraphgetUGraph()Call methodminimize()before using this method.intgetVectorFieldIndex()Get index of vector field of domain geometry.booleangetVisibleComponent(int index)booleangetVisibleFeat(int index)booleangetVisibleGraph(int index)PgSurfaceGraphgetWGraph()Call methodminimize()before using this method.booleangetZeroBoundsU()booleangetZeroBoundsV()static PgPointSetgetZExtrema(PgElementSet surface, java.awt.Color min, java.awt.Color other, java.awt.Color max, double eps)Extract local extreme with respect to z-direction and return as new point set.voidinit()Initialize and reset project, stops the running animation if any.booleanisEnabledAutoDecompose()Determines if automatic Hodge decomposition on updates of geometry is enabled.booleanisShowingDisplay(int dispIndex)Handling of the displays that show the vector field components and the potentials.voidremoveGeometry()Remove the assigned geometry and its backup clone.voidreset()TODO: Not implemented yet.voidselectVectorField(int vfIndex)Selects a vector field of the underlying domain.voidsetDetectionFlags(int flag)Sets which features to include in feature detection.voidsetEnabledAutoDecompose(boolean flag)Automatically compute Hodge decomposition on updates of geometry.voidsetGeometry(PgGeometry geom)Assign a geometry on which this workshop operates, and create a backup clone of the geometry.voidsetIconScale(double value)Scales the icons that are drawn for sinks, sources, vortices and saddles.voidsetVisibleComponent(int index, boolean visible)voidsetVisibleFeat(int index, boolean visible)voidsetVisibleGraph(int index, boolean visible)voidsetZeroBounds(boolean flag)Whether the two resulting potentials should be zero on the boundary.voidsetZeroBoundsU(boolean flag)Sets zero boundary condition of potential of rotation free part (so this vector field is tangential to boundary edges if set).voidsetZeroBoundsV(boolean flag)Sets zero boundary condition of potential of divergence free part (so this part is orthogonal to boundary edges if set).voidshowDisplay(int dispIndex, boolean bVisible)Handling of the displays that show the vector field components and the potentials.voidstop()Stop minimization explicitly before it is completed.booleanupdate(java.lang.Object event)Update this workshop when a depend child changes.-
Methods inherited from class jvx.project.PjWorkshop
cancel, getDisplay, getDisplays, getGeometry, getMode, getSavedGeometry, getViewer, isModal, isStandalone, ok, setDisplay, setDisplays, setModal, setMode, setStandalone, setViewer
-
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jv.object.PsUpdateIf
getFather, getName, setParent
-
-
-
-
Field Detail
-
DETECT_SINKS_SOURCES
public static final int DETECT_SINKS_SOURCES
- See Also:
- Constant Field Values
-
DETECT_VORTICES
public static final int DETECT_VORTICES
- See Also:
- Constant Field Values
-
DETECT_SADDLES
public static final int DETECT_SADDLES
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init()
Description copied from class:PjWorkshopInitialize and reset project, stops the running animation if any. Does not reset any registered display nor geometry. They must be reset individually in each subclass.- Overrides:
initin classPjWorkshop
-
close
public void close()
Removes geometry and displays from workshop, and closes super workshop.- Overrides:
closein classPjWorkshop- Version:
- 06.08.05, 1.10 revised (kp) Code tuned.
-
reset
public void reset()
TODO: Not implemented yet.- Overrides:
resetin classPjWorkshop
-
removeGeometry
public void removeGeometry()
Description copied from class:PjWorkshopRemove the assigned geometry and its backup clone. Subclasses frequently overwrite this method but are advised to call this method.- Overrides:
removeGeometryin classPjWorkshop
-
setGeometry
public void setGeometry(PgGeometry geom)
Description copied from class:PjWorkshopAssign a geometry on which this workshop operates, and create a backup clone of the geometry. The backup geometry is restored if the workshop is canceled.Subclasses frequently overwrite this method but are advised to call this method.
- Specified by:
setGeometryin interfacePjWorkshopIf- Overrides:
setGeometryin classPjWorkshop- Parameters:
geom- the workshop modifies this geometry.
-
update
public boolean update(java.lang.Object event)
Update this workshop when a depend child changes.- Specified by:
updatein interfacePsUpdateIf- Overrides:
updatein classPjWorkshop- Parameters:
event- sender of this update.- Returns:
- true if update was correctly handled by superclass.
- See Also:
PsObject.setParent(PsUpdateIf),PsObject.getFather(),PsObject.addUpdateListener(PsUpdateIf)
-
getVectorFieldIndex
public int getVectorFieldIndex()
Get index of vector field of domain geometry.
-
selectVectorField
public void selectVectorField(int vfIndex)
Selects a vector field of the underlying domain.- Parameters:
vfIndex- Select element based vector field of current geometry
-
setZeroBounds
public void setZeroBounds(boolean flag)
Whether the two resulting potentials should be zero on the boundary. That means that the vector field components are orthogonal and tangential to the boundary edges respectively.
-
setZeroBoundsU
public void setZeroBoundsU(boolean flag)
Sets zero boundary condition of potential of rotation free part (so this vector field is tangential to boundary edges if set).
-
getZeroBoundsU
public boolean getZeroBoundsU()
-
setZeroBoundsV
public void setZeroBoundsV(boolean flag)
Sets zero boundary condition of potential of divergence free part (so this part is orthogonal to boundary edges if set).
-
getZeroBoundsV
public boolean getZeroBoundsV()
-
isEnabledAutoDecompose
public boolean isEnabledAutoDecompose()
Determines if automatic Hodge decomposition on updates of geometry is enabled.- Returns:
- true if auto Hodge decomposition is enabled
-
setEnabledAutoDecompose
public void setEnabledAutoDecompose(boolean flag)
Automatically compute Hodge decomposition on updates of geometry.- Parameters:
flag- true to enable automatic Hodge decomposition
-
getRotationFree
public PgVectorField getRotationFree()
Call methodminimize()before using this method.
-
getDivergenceFree
public PgVectorField getDivergenceFree()
Call methodminimize()before using this method.
-
getHarmonic
public PgVectorField getHarmonic()
Call methodminimize()before using this method.
-
getPotentialU
public PgElementSet getPotentialU()
Call methodminimize()before using this method.- Returns:
- potential of rotation free part
-
getPotentialW
public PgElementSet getPotentialW()
Call methodminimize()before using this method.- Returns:
- potential of divergence free part
-
getUGraph
public PgSurfaceGraph getUGraph()
Call methodminimize()before using this method.- Returns:
- potential of rotation free part
-
getWGraph
public PgSurfaceGraph getWGraph()
Call methodminimize()before using this method.- Returns:
- potential of divergence free part
-
setVisibleComponent
public void setVisibleComponent(int index, boolean visible)
-
getVisibleComponent
public boolean getVisibleComponent(int index)
-
setVisibleGraph
public void setVisibleGraph(int index, boolean visible)
-
getVisibleGraph
public boolean getVisibleGraph(int index)
-
setVisibleFeat
public void setVisibleFeat(int index, boolean visible)
-
getVisibleFeat
public boolean getVisibleFeat(int index)
-
setDetectionFlags
public void setDetectionFlags(int flag)
Sets which features to include in feature detection. Default is to detect nothing (flag==0).- Parameters:
flag- binary flag; combine the DETECT_... constants with binary OR operator.
-
getDetectionFlags
public int getDetectionFlags()
Compare the DETECT_... constants.- See Also:
setDetectionFlags(int)
-
setIconScale
public void setIconScale(double value)
Scales the icons that are drawn for sinks, sources, vortices and saddles.- Parameters:
value- default is 1.
-
isShowingDisplay
public boolean isShowingDisplay(int dispIndex)
Handling of the displays that show the vector field components and the potentials.
-
showDisplay
public void showDisplay(int dispIndex, boolean bVisible)Handling of the displays that show the vector field components and the potentials.
-
getDisplay
public PvDisplayIf getDisplay(int dispIndex)
Returns one of the three displays: rotation-free, divergence-free and harmonic component and their features.- Parameters:
dispIndex- 0-2
-
decompose
public void decompose()
Initiates minimization of the two energies that produce the three parts of the decomposition. As the minimization is done in separate threads this method perhaps returns without instant effect. The update method of the parent of this PwHodge object is called with this object as argument when the computation of the vector field parts is finished.A call of minimize() will terminate instantly, if there is already an unterminated minimization process running at the moment!!! To ensure that a new minimization is initiated, call
stop()first and thenminimize()!
-
stop
public void stop()
Stop minimization explicitly before it is completed.update(this)needs to be called to inform info panel.
-
getZExtrema
public static PgPointSet getZExtrema(PgElementSet surface, java.awt.Color min, java.awt.Color other, java.awt.Color max, double eps)
Extract local extreme with respect to z-direction and return as new point set.
-
-
"