[16287] | 1 | %SPHEREMESH class definition
|
---|
[12913] | 2 | %
|
---|
| 3 | % Usage:
|
---|
[16287] | 4 | % spheremesh=spheremesh();
|
---|
[12913] | 5 |
|
---|
[16287] | 6 | classdef spheremesh
|
---|
[12913] | 7 | properties (SetAccess=public)
|
---|
[12980] | 8 | x = NaN;
|
---|
| 9 | y = NaN;
|
---|
| 10 | z = NaN;
|
---|
[12913] | 11 | r = NaN;
|
---|
| 12 | theta = NaN;
|
---|
| 13 | phi = NaN
|
---|
| 14 | elements = NaN
|
---|
| 15 | numberoflayers = 0;
|
---|
| 16 | numberofelements = 0;
|
---|
| 17 | numberofvertices = 0;
|
---|
[13646] | 18 |
|
---|
[12913] | 19 | vertexconnectivity = NaN
|
---|
| 20 | elementconnectivity = NaN
|
---|
| 21 | average_vertex_connectivity = 0;
|
---|
| 22 | end
|
---|
| 23 | methods
|
---|
[19105] | 24 | function self = spheremesh(varargin) % {{{
|
---|
[12913] | 25 | switch nargin
|
---|
| 26 | case 0
|
---|
[19105] | 27 | self=setdefaultparameters(self);
|
---|
[12913] | 28 | otherwise
|
---|
| 29 | error('constructor not supported');
|
---|
| 30 | end
|
---|
| 31 | end % }}}
|
---|
[19105] | 32 | function self = setdefaultparameters(self) % {{{
|
---|
[12913] | 33 |
|
---|
| 34 | %the connectivity is the avergaded number of nodes linked to a
|
---|
| 35 | %given node through an edge. This connectivity is used to initially
|
---|
| 36 | %allocate memory to the stiffness matrix. A value of 16 seems to
|
---|
| 37 | %give a good memory/time ration. This value can be checked in
|
---|
| 38 | %trunk/test/Miscellaneous/runme.m
|
---|
[19105] | 39 | self.average_vertex_connectivity=25;
|
---|
[12913] | 40 | end % }}}
|
---|
[19105] | 41 | function md = checkconsistency(self,md,solution,analyses) % {{{
|
---|
[12913] | 42 |
|
---|
[20500] | 43 | md = checkfield(md,'fieldname','spheremesh.x','NaN',1,'Inf',1,'size',[md.spheremesh.numberofvertices 1]);
|
---|
| 44 | md = checkfield(md,'fieldname','spheremesh.y','NaN',1,'Inf',1,'size',[md.spheremesh.numberofvertices 1]);
|
---|
| 45 | md = checkfield(md,'fieldname','spheremesh.z','NaN',1,'Inf',1,'size',[md.spheremesh.numberofvertices 1]);
|
---|
| 46 | md = checkfield(md,'fieldname','spheremesh.r','NaN',1,'Inf',1,'size',[md.spheremesh.numberofvertices 1]);
|
---|
| 47 | md = checkfield(md,'fieldname','spheremesh.theta','NaN',1,'Inf',1,'size',[md.spheremesh.numberofvertices 1]);
|
---|
| 48 | md = checkfield(md,'fieldname','spheremesh.phi','NaN',1,'Inf',1,'size',[md.spheremesh.numberofvertices 1]);
|
---|
| 49 | md = checkfield(md,'fieldname','spheremesh.elements','NaN',1,'Inf',1,'>',0,'values',1:md.spheremesh.numberofvertices);
|
---|
[17806] | 50 | md = checkfield(md,'fieldname','spheremesh.elements','size',[md.spheremesh.numberofelements 3]);
|
---|
[16287] | 51 | if any(~ismember(1:md.spheremesh.numberofvertices,sort(unique(md.spheremesh.elements(:)))));
|
---|
| 52 | md = checkmessage(md,'orphan nodes have been found. Check the spheremesh outline');
|
---|
[12913] | 53 | end
|
---|
[17806] | 54 | md = checkfield(md,'fieldname','spheremesh.numberoflayers','>=',0);
|
---|
| 55 | md = checkfield(md,'fieldname','spheremesh.numberofelements','>',0);
|
---|
| 56 | md = checkfield(md,'fieldname','spheremesh.numberofvertices','>',0);
|
---|
[20500] | 57 | md = checkfield(md,'fieldname','spheremesh.elementconnectivity','size',[md.spheremesh.numberofelements 3],'NaN',1,'Inf',1);
|
---|
[12913] | 58 | end % }}}
|
---|
[19105] | 59 | function disp(self) % {{{
|
---|
[12913] | 60 | disp(sprintf(' Mesh:'));
|
---|
| 61 |
|
---|
| 62 | disp(sprintf('\n Elements and vertices:'));
|
---|
[19105] | 63 | fielddisplay(self,'numberofelements','number of elements');
|
---|
| 64 | fielddisplay(self,'numberofvertices','number of vertices');
|
---|
| 65 | fielddisplay(self,'elements','vertex indices of the mesh elements');
|
---|
| 66 | fielddisplay(self,'x','vertices x coordinate [m]');
|
---|
| 67 | fielddisplay(self,'y','vertices y coordinate [m]');
|
---|
| 68 | fielddisplay(self,'z','vertices z coordinate [m]');
|
---|
| 69 | fielddisplay(self,'r','vertices r coordinate [m]');
|
---|
| 70 | fielddisplay(self,'theta','vertices theta coordinate [degrees]');
|
---|
| 71 | fielddisplay(self,'phi','vertices phi coordinate [degrees]');
|
---|
[12913] | 72 |
|
---|
| 73 | disp(sprintf('\n Properties:'));
|
---|
[19105] | 74 | fielddisplay(self,'numberoflayers','number of extrusion layers');
|
---|
[13646] | 75 |
|
---|
[19105] | 76 | fielddisplay(self,'vertexconnectivity','list of vertices connected to vertex_i');
|
---|
| 77 | fielddisplay(self,'elementconnectivity','list of vertices connected to element_i');
|
---|
| 78 | fielddisplay(self,'average_vertex_connectivity','average number of vertices connected to one vertex');
|
---|
[12913] | 79 |
|
---|
| 80 | end % }}}
|
---|
[21341] | 81 | function marshall(self,prefix,md,fid) % {{{
|
---|
| 82 | WriteData(fid,prefix,'object',self,'fieldname','x','format','DoubleMat','mattype',1);
|
---|
| 83 | WriteData(fid,prefix,'object',self,'fieldname','y','format','DoubleMat','mattype',1);
|
---|
| 84 | WriteData(fid,prefix,'object',self,'fieldname','z','format','DoubleMat','mattype',1);
|
---|
| 85 | WriteData(fid,prefix,'object',self,'fieldname','r','format','DoubleMat','mattype',1);
|
---|
| 86 | WriteData(fid,prefix,'object',self,'fieldname','theta','format','DoubleMat','mattype',1);
|
---|
| 87 | WriteData(fid,prefix,'object',self,'fieldname','phi','format','DoubleMat','mattype',1);
|
---|
| 88 | WriteData(fid,prefix,'object',self,'fieldname','elements','format','DoubleMat','mattype',2);
|
---|
| 89 | WriteData(fid,prefix,'object',self,'fieldname','numberoflayers','format','Integer');
|
---|
| 90 | WriteData(fid,prefix,'object',self,'fieldname','numberofelements','format','Integer');
|
---|
| 91 | WriteData(fid,prefix,'object',self,'fieldname','numberofvertices','format','Integer');
|
---|
| 92 | WriteData(fid,prefix,'object',self,'fieldname','elementconnectivity','format','DoubleMat','mattype',3);
|
---|
| 93 | WriteData(fid,prefix,'object',self,'fieldname','average_vertex_connectivity','format','Integer');
|
---|
[12913] | 94 | end % }}}
|
---|
| 95 | end
|
---|
| 96 | end
|
---|