Commit 50d06e9c authored by Philipp Marco Schäfer's avatar Philipp Marco Schäfer

Merge branch 'combined_wave_and_ga_simulation'

parents 48b6dc0e 4940c7c7
classdef itaMesh
% <ITA-Toolbox>
% This file is part of the application Meshing for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
% </ITA-Toolbox>
%ITAMESH Summary of this class goes here
% Detailed explanation goes here
%ITAMESH Represents a mesh used in simulations like FEM/BEM
% A mesh consists of a list of nodes (see itaMeshNodes) which form
% shell and/or volume elements (see itaMeshElements). Additionally,
% the nodes can be grouped using itaMeshGroup.
%
% Supported element shapes are tetraheadron/triangle (tetra) and
% quadrilateral (quad) with linear or parabolic order.
% For more information see itaMeshElements.
% <ITA-Toolbox>
% This file is part of the application Meshing for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
% </ITA-Toolbox>
%Author: mmt
%Created: 2009?
properties(Access = protected)
mNodes = itaMeshNodes;
......@@ -16,23 +25,32 @@ classdef itaMesh
end
properties(Dependent)
nodes;
shellElements;
volumeElements;
groups;
nNodes;
nElements;
nShellElements;
nVolumeElements;
nGroups;
nodes; %The nodes of this mesh (see itaMeshNodes)
shellElements; %Elements that define the shell of this mesh (see itaMeshElements)
volumeElements; %Elements that define the volume of this mesh (see itaMeshElements)
groups; %Cell-array of groups used in the mesh(see itaMeshGroup)
nNodes; %Number of nodes in this mesh
nElements; %Total number of elements in this mesh
nShellElements; %Number of shell elements in this mesh
nVolumeElements; %Number of volume elements in this mesh
nGroups; %Number of groups in this mesh
end
methods
function this = itaMesh(varargin)
%There are four ways of using the constructor.
%Valid inputs are:
%1) single itaMesh (copy constructor)
%2) a unv-filename
%3) a struct with input properties (nodes/shellElements/volumeElements/groups)
%4) itaMeshNodes, itaMeshElements, itaMeshGroup
% (e.g. itaMesh(nodes, elements, group1, group2,...)
if nargin
if isa(varargin{1},'itaMesh') % copy consructor
this = varargin{1};
elseif ischar(varargin{1})
elseif ischar(varargin{1}) % unv import
foundStuff = 0;
try
try %#ok<TRYNC>
......@@ -72,6 +90,7 @@ classdef itaMesh
catch %#ok<CTCH>
error('itaMesh:I cannot read the specified file');
end
elseif isstruct(varargin{1}) % Struct input/convert
fieldName = fieldnames(varargin{1});
for ind = 1:numel(fieldName)
......@@ -112,6 +131,8 @@ classdef itaMesh
end
function display(this) %#ok<DISPLAY>
% DISPLAY(X) is called for the object X when the semicolon is not used
% to terminate a statement. [overloaded function]
disp('==|itaMesh|============================================================');
if this.nNodes > 0
disp(' Nodes');
......@@ -202,6 +223,7 @@ classdef itaMesh
%% node functions
function nodes = nodeForID(this,ID)
%Returns the itaMeshNodes with the given IDs
if ~all(ismember(ID,this.nodes.ID))
error('itaMesh.nodeForID:some (or all) of the IDs are not in the list');
else
......@@ -214,6 +236,7 @@ classdef itaMesh
end
function nodes = nodesForElement(this,element)
%Returns the itaMeshNodes of the given itaMeshElements
if nargin < 2 || ~isa(element,'itaMeshElements')
error('itaMesh.nodesForElement:I need a meshElements object');
end
......@@ -227,6 +250,7 @@ classdef itaMesh
end
function nodes = nodesForGroup(this,group)
%Returns the itaMeshNodes of the given itaMeshGroup
if nargin < 2 || ~isa(group,'itaMeshGroup')
error('itaMesh.nodesForGroup:I need a meshGroup object');
end
......@@ -248,6 +272,7 @@ classdef itaMesh
%% element functions
function elements = shellElementForID(this,ID)
%Returns the shell elements (itaMeshElements) of the given IDs
shellElementID = this.mShellElements.ID;
tmpShellID = ID(ismember(ID,shellElementID));
......@@ -264,6 +289,7 @@ classdef itaMesh
function elements = volumeElementForID(this,ID)
%Returns the volume elements (itaMeshElements) of the given IDs
volumeElementID = this.mVolumeElements.ID;
tmpVolumeID = ID(ismember(ID,volumeElementID));
......@@ -280,6 +306,7 @@ classdef itaMesh
function elements = elementsForGroup(this,group)
%Returns the itaMeshElements of the given itaMeshGroup
if nargin < 2 || ~isa(group,'itaMeshGroup')
error('itaMesh.elementsForGroup:I need a meshGroup object');
elseif strcmpi(group.type,'nodes')
......@@ -302,6 +329,7 @@ classdef itaMesh
%% group functions
function value = getGroupIDs(this)
%Returns the IDs of the groups of this mesh
value = [];
if ~isempty(this.mGroups)
for i= 1:numel(this.mGroups)
......@@ -312,6 +340,7 @@ classdef itaMesh
%% plot
function h = plot(this,varargin)
%See ita_plot_mesh
if nargin < 2
h = ita_plot_mesh(this);
else
......@@ -349,6 +378,7 @@ classdef itaMesh
end
function result = propertiesSaved
%Returns the names of the properties that are saved
result = {'nodes','shellElements','volumeElements','groups'};
end
end
......
function varargout = horzcat(varargin)
%Concatenates elements horizontally
% <ITA-Toolbox>
% This file is part of the application Meshing for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
......
classdef itaMeshElements < itaMeta
% <ITA-Toolbox>
% This file is part of the application Meshing for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
% </ITA-Toolbox>
% Class for mesh elements
% mmt, 15.8.09
%
% This class allows to store the ID and referred nodes of mesh elements
%
......@@ -21,6 +16,14 @@ classdef itaMeshElements < itaMeta
% tetra: 4 nodes (linear), 10 nodes (parabolic)
% quad : 8 nodes (linear), 20 nodes (parabolic)
% <ITA-Toolbox>
% This file is part of the application Meshing for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
% </ITA-Toolbox>
%Author: mmt
%Created: 15.8.09
properties(Access = private)
mID = [];
mNodes = nan(0,3);
......@@ -30,12 +33,12 @@ classdef itaMeshElements < itaMeta
end
properties(Dependent)
ID
nodes
shape
type
nElements
order
ID %Unique IDs of the stored mesh elements
nodes %Respective IDs of the nodes for each element
shape %Shape of the stored elements (tetra/quad)
type %Elementtype (shell/volume)
nElements %Total number of elements
order %Order of the shape function(linear/parabolic)
end
methods
......@@ -166,6 +169,8 @@ classdef itaMeshElements < itaMeta
end
function display(this) %#ok<DISPLAY>
% DISPLAY(X) is called for the object X when the semicolon is not used
% to terminate a statement. [overloaded function]
prefix = '(ID=';
middlefix = ['[nodes (n=' num2str(size(this.mNodes,2)) ')] = ['];
elements = this.mNodes;
......@@ -177,11 +182,16 @@ classdef itaMeshElements < itaMeta
% replaces subsref
function result = n(this, index)
%Grants access to elements with given index (internal indexing)
%
%Example: obj.n([1 2 3]) returns an itaMeshElements object
% containing the first three mesh elements
result = this;
result.mID = this.mID(index);
result.mNodes = this.mNodes(index,:);
end
%% Set / Get functions
function this = set.ID(this, value)
if numel(unique(value)) == numel(this.mNodes(:,1))
this.mID = value;
......@@ -230,8 +240,14 @@ classdef itaMeshElements < itaMeta
function value = get.order(this), value = this.mOrder; end
function value = get.nElements(this), value = numel(this.mID); end
function value = isShell(this), value = strcmpi(this.mType,'shell'); end
function value = isVolume(this), value = strcmpi(this.mType,'volume'); end
%% Boolean functions
function value = isShell(this)
%Returns true if the stored elements belong to a shell
value = strcmpi(this.mType,'shell'); end
function value = isVolume(this)
%Returns true if the stored elements belong to a volume
value = strcmpi(this.mType,'volume'); end
%% Overloaded functions
......@@ -249,6 +265,7 @@ classdef itaMeshElements < itaMeta
end
methods(Static)
function this = loadobj(sObj)
% Called when an object is loaded
......
function varargout = vertcat(varargin)
%Concatenates elements vertically
% <ITA-Toolbox>
% This file is part of the application Meshing for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
......
function varargout = horzcat(varargin)
%Concatenates node IDs of given itaMeshGroup objects of same type horizontally
% <ITA-Toolbox>
% This file is part of the application Meshing for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
......
classdef itaMeshGroup < itaMeta
% <ITA-Toolbox>
% This file is part of the application Meshing for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
% </ITA-Toolbox>
% Class for mesh groups
% mmt, 04.1.10
%
% This class allows to store node IDs for mesh groups
% This class groups a set of itaMeshNodes or itaMeshElements using
% their IDs. The group itself has an ID, a name and a type. The latter
% defines the data it contains (nodes, shell elements or volume elements)
% <ITA-Toolbox>
% This file is part of the application Meshing for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
% </ITA-Toolbox>
%Author: mmt
%Created: 04.1.10
properties(Access = private)
mID = [];
......@@ -19,16 +23,16 @@ classdef itaMeshGroup < itaMeta
end
properties(Constant)
VALID_GROUP_TYPES = {'nodes', 'shell elements','volume elements'};
VALID_GROUP_TYPES = {'nodes', 'shell elements','volume elements'}; %Valid strings for the type property
end
properties(Dependent)
ID
groupID;
groupName
type
nNodes
nElements
ID %IDs of the nodes belonging to this group
groupID; %ID of this group
groupName %name of this group
type %indicates what is stored in the group (nodes/shell elements/volume elements)
nNodes %number of nodes
nElements %number of elements
end
methods
......@@ -66,6 +70,8 @@ classdef itaMeshGroup < itaMeta
end
function display(this)
% DISPLAY(X) is called for the object X when the semicolon is not used
% to terminate a statement. [overloaded function]
IDs = this.mID(:);
idStr = cellstr(num2str(IDs));
nIDs = numel(IDs);
......@@ -81,6 +87,10 @@ classdef itaMeshGroup < itaMeta
% replaces subsref
function result = n(this, index)
%Grants access to the node IDs of given index (internal indexing)
%
%Example: obj.n([1 2 3]) returns an itaMeshGroup object
% containing the first three node IDs
result = this;
result.mID = this.mID(index);
end
......
function varargout = vertcat(varargin)
%Concatenates node IDs of given itaMeshGroup objects of same type vertically
% <ITA-Toolbox>
% This file is part of the application Meshing for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
......
classdef itaMeshNodes < itaMeta & itaCoordinates
% <ITA-Toolbox>
% This file is part of the application Meshing for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
% </ITA-Toolbox>
% Class for mesh nodes, represented by a unique ID and coordinates
% inherited from itaCoordinates
% mmt, 15.8.09
%
% This class allows to store the ID and coordinates of a mesh node.
% <ITA-Toolbox>
% This file is part of the application Meshing for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
% </ITA-Toolbox>
%Author: mmt
%Created: 15.8.09
properties(Access = private)
mID;
end
properties(Dependent)
ID;
ID; %Unique IDs of the stored nodes
end
methods
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment