From: Vincent Huang on
Hi all,

I am looking for help on making my object's field public in matlab

fem0.sol.u(17:120:28817,11)=100;
??? Access to an object's fields is only permitted within its methods.

Please share your expertise.

Thanks in advance!

Regards,

Vincent
From: Vincent Huang on
"Vincent Huang" <huangwen(a)hotmail.com> wrote in message <hm8p2k$qlk$1(a)fred.mathworks.com>...
> Hi all,
>
> I am looking for help on making my object's field public in matlab
>
> fem0.sol.u(17:120:28817,11)=100;
> ??? Access to an object's fields is only permitted within its methods.
>
> Please share your expertise.
>
> Thanks in advance!
>
> Regards,
>
> Vincent
From: Vincent Huang on
anyone know?
From: Doug Schwarz on
In article <hm8p2k$qlk$1(a)fred.mathworks.com>,
"Vincent Huang" <huangwen(a)hotmail.com> wrote:

> Hi all,
>
> I am looking for help on making my object's field public in matlab
>
> fem0.sol.u(17:120:28817,11)=100;
> ??? Access to an object's fields is only permitted within its methods.
>
> Please share your expertise.
>
> Thanks in advance!
>
> Regards,
>
> Vincent

You don't show your class code, but I'll ask the obvious question: did
you set the access attribute of your property to private? If so, don't
do that!

If you really need your property to be private then you'll have to make
a method to access the property.

If you just want to peek at the contents of an object while working at
the command line you can use struct:

obj = myclass;
s = struct(obj);

It will expose everything (I think), but you won't be able to change the
original object.

--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.
From: Vincent Huang on
Hi,

Thank you for the reply.

fem0.sol.u(17:120:28817,11)=100;
> ??? Access to an object's fields is only permitted within its methods.

I am using COMSOL with Matlab for my simulation project and the solution object is generated by COMSOL (femsolver.m).

May I have an example of making a method to access the private property and change the original object?

regards,

Vincent










>> help femsolver
FEMSOLVER Common solver properties.
This file contains a list of all common solver property value
pairs in COMSOL Multiphysics. This function is not to be called
directly.

Property Value/{Default} Description
----------------------------------------------------------------------
Assemtol scalar {1e-12} Drop tolerance in matrix assembly
Blocksize integer {5000} Assembly block size
Complexfun {'off'} | 'on' Use complex-valued functions with
real input
Conjugate {'off'} | 'on' Hermitian transpose
Const cell array Definition of constants
Constr {'auto'} | 'ideal' | Constraint force Jacobian
'nonideal'
Init solution object | Initial value
numeric vector | scalar
Linsolver {'umfpack'} | 'spooles' | Linear system solver
'pardiso' |
'taucs_llt_mf' |
'taucs_ldlt' | 'luinc' |
'taucs_llt' | 'gmres' |
'fgmres' | 'cg' | 'amg' |
'gmg' | 'ssor' | 'ssoru' |
'sor' | 'soru' | 'jac' |
'lumped'
Matherr {'on'} | 'off' Error for undefined operations
Mcase non-negative integer (or Mesh case
vector for GMG)
{mesh case with largest
number of DOFs}
Method {'eliminate'} | Constraint handling method
'lagrange' |
'elimlagr' | 'spring'
Nullfun {'auto'} | 'flnullorth' | Null space function
'flspnull'
Outcomp cell array of strings Solution components to
store in output
Report {'on'} | 'off' Show progress dialog box
Rowscale {'on'} | 'off' Equilibrate rows
Solcomp cell array of strings Degree of freedom names to solve for
Solfile {'off'} | 'on' Store solution on file
Solfileblock positive scalar Max size of solution block (MB)
Solfilename string Name of solution file
Stop {'on'} | 'off' Deliver partial solution when
failing
Symmetric 'off' | 'on' | {'auto'} Symmetric (Hermitian)
Symmtol scalar between 0 and 1 Relative tolerance used in
{1e-10} automatic symmetric detection
U solution object | Value of variables not solved for
numeric vector | scalar and linearization point
Uscale {'auto'} | 'init' | Scaling of variables
'none' | cell array |
solution vector

See the entry FEMSOLVER in the COMSOL Multiphysics Reference Guide
for more information about the property/values.

Probe plot properties to time dependent solver and parametric solver:

Property Value/{Default} Description
----------------------------------------------------------------------
Plotglobal String or cell array of Global plot expression
strings
Plotglobalpar Cell array or cell array Property/values to
of cell array postglobaleval
Plotint String or cell array of Integration plot expression
strings
Plotintpar Cell array or cell array Property/values to
of cell array postint
Plotinterp String or cell array of Interpolation plot expression
strings
Plotinterppar Cell array or cell array Property/values to
of cell array postinterp

The properties plotglobalpar, plotinpar, and plotinterppar must
be a cell-array containing property/values to the corresponding
evaluating function POSTGLOBALEVAL, POSTINT, and POSTINTERP,
respectively. In addition, the property 'title' can be
specified. Also, plotinterppar must contain the property
'probecoord' with the value being an sdim-by-n coordinare matrix.
If, for example, plotint is a cell array of expressions to plot,
plotintpar can either be a cell array of property/values, or,
if different property/values are to be specified for the different
expressions, a cell array of cell arrays of property/values.

An example of a FEMSTATIC call for a parametric problem specifying
one global expression, one interpolation expression, and two
integration expressions.

fem.sol = femstatic(fem, ...
'solcomp',{}, ...
'outcomp',{}, ...
'plotglobal',{'w1','w2'}, ...
'plotglobalpar',{'phase',pi,'title','Global'}, ...
'plotinterp','u', ...
'plotinterppar',{'probecoord',[0.1; 0.2]}, ...
'plotint',{'u','ux','uy'}, ...
'plotintpar',{{'phase',0, 'edim',0,'dl',4}, ...
{'phase',pi,'edim',1,'intorder',5},...
{'phase',pi,'edim',2,'dl',[3,6,7]}});

Direct solver properties (UMFPACK, SPOOLES, PARDISO, TAUCS_LLT_MF, LUINC,
TAUCS_LLT):

Property Value/{Default} Description
----------------------------------------------------------------------
Droptol scalar between 0 and 1 Drop tolerance
{0.01 when used as (LUINC, TAUCS_LLT, UMFPACK, SPOOLES)
preconditioner, 0 when
used as solver}
Errorchk {'on'} | 'off' | 'auto' Check error estimate (PARDISO)
Errorchkd 'on' | {'off'} Check error estimate
(UMFPACK, SPOOLES)
Fillratio non-negative scalar Column fill ratio (LUINC)
Modified {'off'} | 'on' Modified incomplete Cholesky
(TAUCS_LLT)
Pivotperturb scalar between 0 and 1 Pivot perturbation threshhold
{1e-8} (PARDISO)
Pivotrefines non-negative integer {0} Number of forced iterative
refinements (PARDISO)
Preorder {'mmd'} | 'nd' | 'ms' | Preordering algorithm (SPOOLES)
'both'
Pardreorder 'mmd' | {'nd'} Preordering algorithm (PARDISO)
Pardrreorder {'on'} | 'off' Row preordering algorithm (PARDISO)
Respectpattern {'on'} | 'off' Do not drop original nonzeros (LUINC)
Rhob scalar > 1 {400} Factor in linear error estimate
(PARDISO)
Thresh scalar between 0 and 1 Pivot threshold (UMFPACK, SPOOLES,
{0.1 UMFPACK, SPOOLES, LUINC)
1 LUINC}
Umfalloc non-negative scalar {0.7} Memory allocation factor (UMFPACK)

Iterative solver properties (LUINC, GMRES, FGMRES, CG, AMG, GMG,
SSOR, SSORU, SOR, SORU, JAC, SSORVEC, SORVEC, SORUVEC, SSORGAUGE, SORGAUGE,
SORUGAUGE, Vanka):

Property Value/{Default} Description
----------------------------------------------------------------------
Iluiter non-negative integer {1} Fixed number of iterations (when used
as preconditioner, smoother, or
coarse solver) (luinc)
Iter non-negative integer {2} Fixed number of iterations (when
used as preconditioner, smoother, or
coarse solver) (all except luinc)
Itol positive real {1e-6, 0.1 Relative tolerance (note that when
coarse solver} used as preconditioner or smoother
a fixed number of iterations is
default)
Itrestart positive integer {50} Restart value (GMRES, FGMRES)
Maxlinit positive integer {10000, Maximum number of linear iterations
500 coarse solver} (when used with a tolerance)
Prefun {'luinc'} | 'taucs_llt' Preconditioner (GMRES, FGMRES, CG)
'umfpack' | 'spooles' |
'gmres' | 'cg' | 'amg' |
'gmg' | 'ssor' | 'ssoru' |
'sor' | 'soru' | 'jac' |
'ssorvec' | 'sorvec' |
'soruvec' | 'ssorgauge' |
'sorgauge' | 'sorugauge' |
'vanka' | 'lumped' |
'none'
Prefuntype {'left'} | 'right' Left or right preconditioning
(GMRES, CG)
Prepar cell array of property/ Preconditioner properties
value pairs (GMRES, FGMRES, CG)
Relax scalar between 0 and 2 Relaxation factor (Jacobi,
{1} SOR-based algorithms, incomplete
LU, and Vanka)
Rhob scalar >= 1 {400, 1 Factor in linear error estimate (when
coarse solver} used with a tolerance)
Seconditer nonnegative integer {1} Number of secondary iterations
(SOR vector and SOR gauge
algorithms), number of SSOR updates
(Vanka)
Sorblocked 'on' | {'off'} Blocked SOR method
Sorvecdof cell array of strings Vector element variables (SOR vector
and SOR gauge algorithms)
Vankablocked 'on' | {'off'} Blocked Vanka method
Vankarelax scalar between 0 and 2 Relaxation factor for Vanka update
{0.8}
Vankarestart positive integer {100} GMRES restart value (Vanka)
Vankasolv {'gmres'} | 'direct' Local block solver (Vanka)
Vankatol positive scalar {0.02} GMRES tolerance (Vanka)
Vankavars cell array of strings Lagrange multiplier variables (Vanka)

Multigrid solver properties (AMG, GMG):

Property Value/{Default} Description
----------------------------------------------------------------------
Amgauto integer between 1 and 10 Quality of multigrid hierarchy
{3} (AMG)
Csolver {'umfpack'} | 'spooles' | Coarse solver
'pardiso' |
'taucs_llt_mf' |
'taucs_ldlt' | 'luinc' |
'taucs_llt' | 'gmres' |
'fgmres' | 'cg' | 'amg' |
'ssor' | 'ssoru' |
'sor' | 'soru' | 'jac' |
'ssorvec' | 'sorvec' |
'soruvec' | 'ssorgauge' |
'sorgauge' | 'sorugauge' |
'vanka' | 'lumped'
Csolverpar cell array Coarse solver properties
Maxcoarsedof positive integer {5000} Maximum number of DOFs at coarsest
level (AMG)
Meshscale vector of positive Mesh scale factor (GMG)
numbers {2}
Mgassem {'on'} | 'off' | Assemble on coarse levels (GMG)
numeric vector
Mgauto 'off' | 'explicit' | Method for multigrid hierarchy
'meshscale' | 'shape' | construction (GMG)
'both' | 'meshrefine'
Mgcycle {'v'} | 'w' | 'f' Cycle type
Mggeom vector of positive Geometry numbers for multigrid
integers {all} hierarchy (GMG)
Mgkeep {'off'} | 'on' Keep generated mesh cases (GMG)
Mglevels integer>1 {6 AMG, 2 GMG} Max number of multigrid levels
Postsmooth 'ssor' | 'ssoru' | 'sor' Postsmoother
| {'soru'} | 'jac' |
'ssorvec' | 'sorvec' |
'soruvec' | 'ssorgauge' |
'sorgauge' | 'sorugauge'
| 'vanka' | 'luinc' |
'gmres' | 'fgmres' | 'cg'
| 'amg'
Postsmoothpar cell array Postsmoother properties
Presmooth 'ssor' | 'ssoru' | Presmoother
{'sor'} | 'soru' | 'jac'
| 'ssorvec' | 'sorvec' |
'soruvec' | 'ssorgauge' |
'sorgauge' | 'sorugauge'
| 'vanka' | 'luinc' |
'gmres' | 'fgmres' | 'cg'
| 'amg'
Presmoothpar cell array Presmoother properties
Rmethod {'regular'} | 'longest' Mesh refinement method (GMG)
Shapechg vector of integers Change in shape function orders
{-1} (GMG)