public class PnEnergyMinimizer extends PsObject implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
static int |
ALIGNMENT |
static int |
AREA |
static int |
CONFORMAL |
static int |
DIRICHLET |
static int |
GAUSS |
static int |
SPRING |
static int |
VOLUME |
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 and Description |
---|
PnEnergyMinimizer() |
Modifier and Type | Method and Description |
---|---|
int |
computeEigenvectors()
Compute eigenvectors either of Hessian or of an L2-corrected Hessian.
|
void |
enableUpdateDomain(boolean flag)
Flag whether domain is updated after each CG-minimization loop.
|
PgElementSet |
getDomain()
Get currently registered domain geometry.
|
java.lang.String[] |
getEigenSolver() |
PsPanel |
getEigenSolverPanel(int id) |
PnEnergy |
getEnergy()
Get current energy.
|
double |
getInitialStepsize()
Get stepsize used in cg iteration.
|
PgElementSet |
getSurface()
Get currently registered surface.
|
void |
init()
If instance has missing name then assign default name 'Object_NUMBER' where
number is the total number of already created instances.
|
boolean |
isEnabledConstrainMatrix()
Determine if usage of a constrain matrix is enabled.
|
boolean |
isEnabledFixVertices()
Determine if marked vertices remain fixed during minimization.
|
boolean |
isRunning()
Check whether energy minimizer will be stopped.
|
boolean |
isStopped()
Check whether energy minimizer is currently NOT running a minimizing thread.
|
double |
minimize()
Minimize energy by invoking conjugate gradient method in a loop.
|
void |
printEigenvalues()
Print eigenvalues of hessian to JavaView console.
|
void |
printEigenvectors()
Print eigenvectors of hessian to JavaView console.
|
void |
printGradient()
Evaluate and print the energy gradient to the JavaView console.
|
void |
printHessian()
Evaluate the Hessian matrix of the energy and print
its content to the JavaView console.
|
void |
run()
Do energy minimization until
m_numLoops are done or until a call of stop(). |
void |
saveEigenvectors()
Save eigenvectors of hessian as vector fields of the surface.
|
void |
setEigenSolver(int id) |
void |
setEnabledConstrainMatrix(boolean flag)
Enable usage of a constrain matrix for index computation of Neumann boundary geometries.
|
void |
setEnabledFixVertices(boolean flag)
Enable if marked vertices remain fixed during minimization.
|
void |
setEnergy(PnEnergy energy)
Set new energy and clear all vector fields.
|
void |
setInitialStepsize(double h)
Set stepsize used in cg iteration.
|
void |
setNumLoops(int numLoops)
Set number of calls of conjugate gradient method to be performed
during each call to PnEnergyMinimizer#minimize().
|
boolean |
setSurface(PgElementSet domain,
PgElementSet surface)
Set references to domain and image surface.
|
void |
setUpdateDomain(boolean flag)
Set flag which enables the updating of the domain with
the current surface after every minimization step.
|
void |
showEigenvector(int ind)
Show eigenvectors of hessian as vector field on the surface.
|
void |
showGradient()
Evaluate and show the gradient as vectors at each vertex.
|
void |
showNone()
Clear all internal vector fields of this class and of the registered surface.
|
void |
start()
Start energy minimization in separate thread.
|
void |
step()
Move vertices in negative gradient direction a certain amount.
|
void |
step(int numSteps)
Move vertices in negative gradient direction a certain amount.
|
void |
stop()
Stop energy minimization in separate thread.
|
boolean |
update(java.lang.Object event)
Update the class whenever a child has changed.
|
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
public static final int DIRICHLET
public static final int AREA
public static final int CONFORMAL
public static final int SPRING
public static final int ALIGNMENT
public static final int VOLUME
public static final int GAUSS
public void init()
PsObject
public boolean update(java.lang.Object event)
update
in interface PsUpdateIf
update
in class PsObject
event
- carries a lot of informationPsObject.setParent(PsUpdateIf)
,
PsObject.getFather()
,
PsObject.addUpdateListener(PsUpdateIf)
public PnEnergy getEnergy()
public void setEnergy(PnEnergy energy)
public boolean isEnabledFixVertices()
public void setEnabledFixVertices(boolean flag)
public boolean isEnabledConstrainMatrix()
public void setEnabledConstrainMatrix(boolean flag)
public void enableUpdateDomain(boolean flag)
public PgElementSet getDomain()
public PgElementSet getSurface()
public boolean setSurface(PgElementSet domain, PgElementSet surface)
Remark: If the geometries are changed outside this energy minimizer, the user must call setSurface() again to update the energy minimizer. Otherwise, further minimization calls will use the old geometry information.
public void setNumLoops(int numLoops)
This number of loops is independent of the number of iterations used in each single invocation of the CG-method, which depends on the requested accuracy PnEnergyMinimizer#m_cgEps.
minimize()
public double minimize()
setNumLoops(int)
public void setUpdateDomain(boolean flag)
public double getInitialStepsize()
public void setInitialStepsize(double h)
public void step()
step(int)
public void step(int numSteps)
h=0.01
. This method is applied
numSteps times.
Method starts a new thread if numSteps>1 which calls step()
.
step()
public void printGradient()
public void showNone()
public void showGradient()
public void printHessian()
public int computeEigenvectors()
public void printEigenvalues()
public void printEigenvectors()
public void saveEigenvectors()
public void showEigenvector(int ind)
public java.lang.String[] getEigenSolver()
public PsPanel getEigenSolverPanel(int id)
id
- of eigensolver corresponding to order in of Names in Array returned by getEigenSolver().public void setEigenSolver(int id)
id
- of eigensolver corresponding to order in of Names in Array returned by getEigenSolver().public boolean isRunning()
public boolean isStopped()
public void start()
public void stop()
public void run()
m_numLoops
are done or until a call of stop().run
in interface java.lang.Runnable
"