← Back to team overview

dolfin team mailing list archive

Re: [Question #153448]: Importing mesh and entities

 

On Wednesday April 20 2011 03:26:51 B. Emek Abali wrote:
> Question #153448 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/153448
> 
>     Status: Answered => Open
> 
> B. Emek Abali is still having a problem:
> Thanks Johan, You followed better than I could prescribe. I can
> understand the situation better and You started to to revise a bit in
> the meshconvert :)

Well, I just applied a patch from Neilen. The code is all greek for me ;)

> Now,
> python
> from dolfin.mesh.meshconvert import *
> convert('Input.inp', XmlHandler('Output.xml'), 'abaqus')
> 
> gets in meshconvert.py
> 1045
>     handler.start_meshfunction("material", 3, num_entities)
> 
> starts
> 854
>     def start_meshfunction(self, name, dim, size):
>         DataHandler.start_meshfunction(self, name, dim, size)
>         fname = os.path.splitext(self.__ofile.name)[0]
>         self.__ofile_meshfunc = file("%s_%s.xml" % (fname, name), "wb")
>         write_header_meshfunction(self.__ofile_meshfunc, dim, size)
> 
> makes only one intermediate data (for more than one material names), but I
> cannot read them mesh = Mesh('Output_material.xml')

I guess your meshfunction is stored in Output_material.xml and that it is a 
function of uints. You can just look att the second line (or something) of the 
file and you get the type. Then you should be able to do:

  mesh = Mesh('Output.xml')
  mf = MeshFunction('uint', mesh, 'Output_material.xml')

> even the output
> mesh = Mesh('Output.xml')
> mf = mesh.data().mesh_function('material')
>
> returns zero

That is because, apperently, meshconverter store the constructed meshfunction 
in a separate file instead of in the mesh as data.
 
Johan
 



Follow ups

References