简体   繁体   中英

Adding a Facet to a G4TessellatedSolid

I am trying to add a facet to a G4TessellatedSolid from Python.

I have defined a Class MyG4TriangularFacet which extends G4TriangularFacet ie the class definition is

 class MyG4TriangularFacet  :  public  G4TriangularFacet

and the relevant constructor is

 MyG4TriangularFacet(G4ThreeVector v0,
                     G4ThreeVector v1,
                     G4ThreeVector v2);

The python code that tries to use it looks like

 facet = MyG4TriangularFacet(v0g4,v1g4,v2g4)

And I try to add it to a G4TessellatedSolid with

 tessellate = G4TessellatedSolid()
 tessellate.AddFacet(facet)

But I get the following error

 tessellate.AddFacet(facet)

 <class 'Boost.Python.ArgumentError'>: Python argument types in
           G4TessellatedSolid.AddFacet(G4TessellatedSolid,MyG4TriangularFacet)           
 did not match C++ signature:
       AddFacet(G4TessellatedSolid {lvalue}, G4VFacet*)

Now I was under the impression that G4TriangularFacet implemented the Virtual function G4VFacet. Is this not the case?

Is the issue that AddFacet is expecting to pass a pointer to G4VFacet? Not sure how one would go about achieving that in Python

忘记为类层次结构添加到类定义中

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM