Skip to content

Commit 1b2fe5c

Browse files
Materials db converted into cell array for faster access (#73)
1 parent 9ee9847 commit 1b2fe5c

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

Code/discretizer/PhysicsSolver.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function applyNeuBC(obj,bcId,bcDofs,bcVals)
162162
bcVar = obj.domain.bcs.getVariable(bcId);
163163
bcId = obj.domain.dofm.getVariableId(bcVar);
164164

165-
% remove inactive dofs
165+
%remove inactive dofs
166166
id = bcDofs == 0;
167167
bcDofs = bcDofs(~id);
168168
bcVals = bcVals(~id);
@@ -218,7 +218,7 @@ function applyDirBC(obj,bcId,bcDofs,bcVals)
218218
for i = 1:nV
219219
obj.domain.J{i,bcVarId}(:,bcDofs) = 0;
220220
end
221-
221+
222222
for iI = 1:numel(obj.domain.interfaces)
223223
if ~isempty(obj.domain.Jum{bcVarId})
224224
obj.domain.Jmu{iI}{bcVarId}(:,bcDofs) = 0;
@@ -241,6 +241,8 @@ function applyDirBC(obj,bcId,bcDofs,bcVals)
241241

242242
end
243243

244+
245+
244246
function J = getJacobian(obj,varargin)
245247

246248
% get the Jacobian blocks affected by the solver
@@ -263,7 +265,7 @@ function applyDirBC(obj,bcId,bcDofs,bcVals)
263265
out = any(strcmp(obj.getField(),bcVar));
264266

265267
end
266-
268+
267269

268270
function out = isSymmetric(obj)
269271

Code/integratedTest/MortarConvergence/poissonMortar.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</simParam>
1212
<Domain>
1313
<Geometry>
14-
<fileName>Input/Mesh/meshes/domain_hexa27_2.vtk</fileName>
14+
<fileName>Input\Mesh\meshes\domain_hexa27_2.vtk</fileName>
1515
</Geometry>
1616
<Gauss>
1717
<nGP>3</nGP>
@@ -35,7 +35,7 @@
3535
<surfaceTag>3</surfaceTag>
3636
</Slave>
3737
<Quadrature>
38-
<type>ElementBasedQuadrature</type>
38+
<type>RBFquadrature</type>
3939
<nGP>6</nGP>
4040
<nInt>5</nInt>
4141
</Quadrature>

Code/materials/Materials.m

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
% MATERIAL - General material class
33

44
properties (Access = public)
5-
% Creation of a Dictionary object (faster than map)
6-
%db = configureDictionary("double","struct");
7-
% configureDictionary is not supported before 2023b
8-
db
5+
db
96
matMap
107
end
118

@@ -17,7 +14,7 @@
1714
return
1815
end
1916

20-
obj.db = containers.Map('KeyType','double','ValueType','any');
17+
obj.db = cell([]);
2118
% Calling the function to read input data from file
2219
obj.readInputFile(input);
2320
end
@@ -29,7 +26,7 @@
2926
% The preliminary check whether matID is key of db has been commented
3027
% since it is highly expensive
3128
% if (obj.db.isKey(matID))
32-
mat = obj.db(obj.matMap(cellTag));
29+
mat = obj.db{obj.matMap(cellTag)};
3330
% else
3431
% Displaying error message if matIdentifier is not a key
3532
% of the map
@@ -39,7 +36,7 @@
3936

4037
function fluidMat = getFluid(obj)
4138
% fluid material is always stored as the last one in the database
42-
fluidMat = obj.db(max(cell2mat(keys(obj.db))));
39+
fluidMat = obj.db{end};
4340
end
4441

4542
function [status] = initializeStatus(obj,cTag,sigma)
@@ -120,7 +117,7 @@ function readInputFile(obj, input)
120117
mat.Curves.betaCorrection(getSpecificWeight(fluid));
121118
end
122119
end
123-
obj.db(i) = mat;
120+
obj.db{i} = mat;
124121
end
125122
end
126123

@@ -132,7 +129,7 @@ function readInputFile(obj, input)
132129
end
133130

134131
if isfield(input,"Fluid")
135-
obj.db(nSolid+1) = fluid;
132+
obj.db{nSolid+1} = fluid;
136133
end
137134

138135
end

0 commit comments

Comments
 (0)