← Back to team overview

dolfin team mailing list archive

Re: [HG DOLFIN] Merge patch from Shawn Walker

 

On Thu, Sep 11, 2008 at 06:43:40PM -0400, Shawn Walker wrote:
> ok, it looks like people have added some things that will be useful.  But 
> I just want to be clear.
>
> 1. When I read the FE signature and dofmap strings from the file (before  
> reading the vector data), I will immediately create a Function (in  
> MeshGeometry class, through the MeshEditor class) with vector data  
> allocated and initialized to zero.

I guess it would be good to use a shared_ptr for the Function in
MeshGeometry since it will need to be initialized by the XML reader.

MeshGeometry and MeshEditor can both have a function that takes the
coordinate mapping as input:

  void setCoordinates(std::tr1::shared_ptr<Function> coordinates);

Then the XML reader just needs to do something like

  std::tr1::shared_ptr<Vector> x = new Vector();
  std::string finite_element_signature;
  std::string dof_map_signature;

  // Read vertex coordinates
  // Read cells
  // Read x
  // Read finite_element_signature
  // Read dof_map_signature

  std::tr1::shared_ptr<Function> coordinates
    = new Function(mesh, x, finite_element_signature, dof_map_signature);

  editor.setCoordinates(coordinates);

Something like that, anyway.

-- 
Anders


> 2. I will then create an XMLVector using the vector data in the Function  
> above.
>
> 3. As I read the file, I will be using the methods of XMLVector to get 
> the data.  Since, XMLVector was called using the vector data already  
> allocated, everything is fine.
>
> 4. I then delete the XMLVector object when I am done reading the file.
>
> The End.  This seems better and is different from the way I did it before.
>
> - Shawn
>
> On Thu, 11 Sep 2008, Anders Logg wrote:
>
>> On Thu, Sep 11, 2008 at 05:12:48PM -0400, Shawn Walker wrote:
>>> ok.  This will probably take me a while to figure out.
>>>
>>> Actually, one dumb question I have is for XMLMesh.  I noticed the
>>> constructor takes a mesh as input:
>>>
>>> XMLMesh::XMLMesh(Mesh& mesh) : XMLObject(), _mesh(mesh), state(OUTSIDE),
>>> f(0), a(0),
>>>                                mesh_coord(0), xml_vector(0)
>>> {
>>>   // Do nothing
>>>
>>> }
>>>
>>> My confusion is, why is the mesh argument needed?  Because at this point,
>>> the mesh hasn't been read in yet.  That's what the XMLMesh class does.  I
>>> realize I am missing something stupid.  I guess this is being called from
>>> XMLFile?
>>>
>>> - Shawn
>>
>> Yes, line 87. The XMLMesh class stores a reference to the mesh so that
>> it can access it to set the values as they are parsed.
>>
>>

Attachment: signature.asc
Description: Digital signature


References