Skip to content

Save internally generated mesh to file #389

Answered by mancellin
joesmerdon asked this question in Q&A
Discussion options

You must be logged in to vote

I see.
The canonical way to save a mesh is to use the standard file formats for meshes as found in the capytaine.io.mesh_writers. See the example in the code below.
However you will lose the information about the degrees of freedom. I tried pickles in the example code below. It seems to work, but does not seem faster than recreating the body from scratch.

import numpy as np
import capytaine as cpt

## GENERATE ARRAY WITH `join_bodies`
mesh_single_body = cpt.mesh_vertical_cylinder(center=(0, 0, -0.5), length=2.0)
single_body = cpt.FloatingBody(mesh=mesh_single_body, dofs=cpt.rigid_body_dofs(rotation_center=(0, 0, -0.5)), name="body")

x_range = np.linspace(0.0, 100.0, 20)
y_range = np.lins…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@mancellin
Comment options

Answer selected by joesmerdon
@mancellin
Comment options

@joesmerdon
Comment options

@joesmerdon
Comment options

@mancellin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants