import_FEB

Below is a demonstration of the features of the import_FEB function

Contents

clear; close all; clc;

Plot settings

fontSize=15;
cMap=gjet(250);

Importing a FEB file

Set main folder

defaultFolder = fileparts(fileparts(mfilename('fullpath')));
pathName=fullfile(defaultFolder,'data','FEB');

Select test file

testCase=2;
switch testCase
    case 1
        febFileNamePart='tetGenModel.feb'; %febio_spec 1.2
    case 2
        febFileNamePart='tempModel.feb'; %febio_spec 2.0
end
febFileName=fullfile(pathName,febFileNamePart);

Import FEB file

[febXML,nodeStruct,elementCell]=import_FEB(febFileName);
--- import_FEB ---
IMPORTING .FEB XML
---> Getting nodes
---> Imported 1368 nodes
---> Getting elements
---> Imported 500 hex8 elements
---> Imported 1280 tri3 elements
DONE!

The output is an XML object for the feb file, a structure containing the nodal information and a structure containing the element descriptions. The content for the import variables is shown below.

The node structure contains two fields, i.e. one containing nodal coordinates and one containing node indices. The latter should strictly be a monotonically increasing and ordered list so may not be required but is provided here just in case the list is not ordered.

nodeStruct
nodeStruct = 

  struct with fields:

        N: [1368×3 double]
    N_ind: [1368×1 double]

The element cell output contains structures for each element set in the model. Element sets are groups of elements with the same material index and the same element type. The structures contain a the element type, the material index, the element matrix (containing the nodal indices), and the element indices.

elementCell{:}

V=nodeStruct.N;
ans = 

  struct with fields:

    E_type: 'hex8'
     E_mat: 1
         E: [500×8 double]
     E_ind: [500×1 double]


ans = 

  struct with fields:

    E_type: 'tri3'
     E_mat: 2
         E: [1280×3 double]
     E_ind: [1280×1 double]

Plotting model

% Plotting the example model surfaces
cFigure; hold on;
title('The imported model','FontSize',fontSize);

for q=1:1:numel(elementCell)

    E=elementCell{q}.E;
    C=elementCell{q}.E_mat;
    elementType=elementCell{q}.E_type;

    if numel(C)==1
        C=C.*ones(size(E,1),1);
    end

    [F,C]=element2patch(E,C,elementType);

    gpatch(F,V,C);
    axisGeom(gca,fontSize);
    colormap(cMap);

end
camlight;
drawnow;

GIBBON www.gibboncode.org

Kevin Mattheus Moerman, [email protected]

GIBBON footer text

License: https://github.com/gibbonCode/GIBBON/blob/master/LICENSE

GIBBON: The Geometry and Image-based Bioengineering add-On. A toolbox for image segmentation, image-based modeling, meshing, and finite element analysis.

Copyright (C) 2019 Kevin Mattheus Moerman

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.