jvx.numeric
Class PnEnergy
- java.lang.Object
-
- jv.object.PsObject
-
- jvx.numeric.PnFunction
-
- jvx.numeric.PnEnergy
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, PsUpdateIf
- Direct Known Subclasses:
- PnAlignmentEnergy, PnAreaEnergy, PnConfEnergy, PnDiriEnergy, PnGaussEnergy, PnSpringEnergy, PnVolumeEnergy
public abstract class PnEnergy extends PnFunction
Energy functional on triangulated surfaces including gradient and hessian computations.Surface must contain all boundary information. Domain is only used by some energy functionals to compute the stiffness matrix.
- See Also:
- Serialized Form
- Author:
- Konrad Polthier
- Version:
- 04.01.01, 2.50 revised (kp) Domain geometry may be missing.
06.06.99, 2.00 revised (kp) Extracted from merged PnAreaEnergy and PnDirichletEnergy.
21.04.99, 1.00 created (kp) from PnDiriEnergy.
-
-
Field Summary
-
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
-
-
Constructor Summary
Constructors Constructor and Description PnEnergy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleancomputeNormalizedHessian(PdMatrix hessian, PdMatrix mass)Compute L2 normalized hessian.doubleeval(PdVector coord)Compute Area energy of a coord vector using the stiffness matrix of a PnArea instance.PdVectorevalGradient(PdVector coord, PdVector gradient)Evaluate Area gradient of a coord vector using the stiffness matrix of a PnArea instance.PdMatrixevalHessian(PdMatrix hessian)Subclass must supply method to compute hessian of energy.PdMatrixgetConstrain()intgetNumOfVariables()Get number of free variables of energy.PdVector[]getSpectrum(PdVector eValue, PdVector[] eVector)Compute eigenvalues and eigenvectors of normalized hessian.booleangetZeroGradientAtBounds()Check if the gradient at the boundary is constrained to zero.voidinit()If instance has missing name then assign default name 'Object_NUMBER' where number is the total number of already created instances.voidinitSurface(PgElementSet domain, PgElementSet surface)Method called from energyMinimizer.minimizeStep() to update the stiffness matrix after conjugate gradient method has returned.booleanisEnabledConstrainMatrix()Determine if usage of a constrain matrix is enabled.booleanisUseConstrainMatrix()voidsetConstrain(PdMatrix constrain)voidsetEnabledConstrainMatrix(boolean flag)Enable usage of a constrain matrix for index computation of Neumann boundary geometries.booleansetSurface(PgElementSet domain, PgElementSet surface)Set domain and surface, and initialize energy structure.voidsetUseConstrainMatrix(boolean useConstrainMatrix)voidsetZeroGradientAtBounds(boolean flag)Constrains the gradient at the boundary to zero or not, if the boundary polygons of the geometry do not exist or have no boundary constraints.voidtestEigenvalues()-
Methods inherited from class jvx.numeric.PnFunction
enableEvaluation, isEvaluable
-
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, update, updatePanels
-
-
-
-
Method Detail
-
init
public void init()
Description copied from class:PsObjectIf instance has missing name then assign default name 'Object_NUMBER' where number is the total number of already created instances.
-
initSurface
public void initSurface(PgElementSet domain, PgElementSet surface)
Method called from energyMinimizer.minimizeStep() to update the stiffness matrix after conjugate gradient method has returned. E.g. PnDiriEnergy should copy surface into domain if in iteration mode i.e. if dimension of domain and surface are equal.- Version:
- 26.08.99 revised (kp) Creation of stiffness matrix moved to subclasses.
-
getNumOfVariables
public int getNumOfVariables()
Get number of free variables of energy.- Specified by:
getNumOfVariablesin classPnFunction
-
isEnabledConstrainMatrix
public boolean isEnabledConstrainMatrix()
Determine if usage of a constrain matrix is enabled.
-
setEnabledConstrainMatrix
public void setEnabledConstrainMatrix(boolean flag)
Enable usage of a constrain matrix for index computation of Neumann boundary geometries.
-
setSurface
public boolean setSurface(PgElementSet domain, PgElementSet surface)
Set domain and surface, and initialize energy structure. Method is called from outside whenever domain or surface has been updated.Domain argument maybe null but surface must always be assigned.
- Parameters:
domain- additional geometry used to specify mapssurface- geometry which is usually optimized- Version:
- 04.01.01, 1.10 revised (kp) Domain geometry may be missing.
26.08.99, 1.05 revised (kp) Creation of stiffness matrix moved to subclasses.
-
setZeroGradientAtBounds
public void setZeroGradientAtBounds(boolean flag)
Constrains the gradient at the boundary to zero or not, if the boundary polygons of the geometry do not exist or have no boundary constraints. Default istrue, i.e. constrained gradient.
-
getZeroGradientAtBounds
public boolean getZeroGradientAtBounds()
Check if the gradient at the boundary is constrained to zero.- See Also:
setZeroGradientAtBounds(boolean)
-
eval
public double eval(PdVector coord)
Compute Area energy of a coord vector using the stiffness matrix of a PnArea instance. Method uses the array m_store of PnArea for intermediate storage and modifies its entries.- Specified by:
evalin classPnFunction- Parameters:
coord- Coordinate vector with list of doubles- Returns:
- double Energy of coordinate vector
- See Also:
PnAreaEnergy- Author:
- Konrad Polthier
- Version:
- 21.04.99, 2.00 revised (kp)
21.04.99, 1.00 created (kp) Derived from PnDiriEnergy.eval()
-
evalGradient
public PdVector evalGradient(PdVector coord, PdVector gradient)
Evaluate Area gradient of a coord vector using the stiffness matrix of a PnArea instance. Along boundary gradient is modified to fulfill any boundary constraints. Special feature for outside calls: If outside wants to evaluate the gradient without allocating gradient, then instead of gradient anullmay be passed. In this case the gradient information is store in an internal variable which is returned as gradient. Handle with care and do not modify size returned gradient.If no special boundary constraints are set, then you may use
setZeroGradientAtBounds(boolean)to set the gradient zero at the boundary (or free again).- Specified by:
evalGradientin classPnFunction- Parameters:
coord- Coordinate vector with list of doublesgradient- Gradient vector to be modified, maybenull.- See Also:
PnAreaEnergy- Author:
- Konrad Polthier
- Version:
- 21.04.99, 2.00 revised (kp)
21.04.99, 1.00 created (kp) Derived from PnDiriEnergy.evalGradient().
-
evalHessian
public PdMatrix evalHessian(PdMatrix hessian)
Subclass must supply method to compute hessian of energy.- Specified by:
evalHessianin classPnFunction- Parameters:
hessian- Hessian of energy with square size
-
getSpectrum
public PdVector[] getSpectrum(PdVector eValue, PdVector[] eVector)
Compute eigenvalues and eigenvectors of normalized hessian.- Parameters:
eValue- Vector to store the eigenvalues. Size will be adjusted.eVector- Possibly empty array to store the eigenvectors. Will be returned.- Author:
- Konrad Polthier
- Version:
- 23.04.00, 1.10 revised (kp) Size of eValue reduced by 1 since no longer NR counting.
15.09.99, 1.00 created (kp) From testEigenvalues() method.
-
computeNormalizedHessian
public boolean computeNormalizedHessian(PdMatrix hessian, PdMatrix mass)
Compute L2 normalized hessian.- Returns:
- success
-
testEigenvalues
public void testEigenvalues()
-
getConstrain
public PdMatrix getConstrain()
- Returns:
- the constrain
-
setConstrain
public void setConstrain(PdMatrix constrain)
- Parameters:
constrain-
-
isUseConstrainMatrix
public boolean isUseConstrainMatrix()
- Returns:
- the m_bUseConstrainMatrix
-
setUseConstrainMatrix
public void setUseConstrainMatrix(boolean useConstrainMatrix)
- Parameters:
useConstrainMatrix-
-
-
"