Commit 7920672d authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

expose particle_uvw and node_volume in python

parent 3730eac9
Pipeline #6837 passed with stage
in 2 minutes and 27 seconds
......@@ -1828,6 +1828,10 @@ void fluid_problem_set_particles(FluidProblem *problem, int n, double *mass, dou
}
}
double *fluid_problem_particle_uvw(FluidProblem *problem) {
return problem->particle_uvw;
}
int *fluid_problem_particle_element_id(FluidProblem *problem)
{
return problem->particle_element_id;
......@@ -1919,6 +1923,11 @@ double *fluid_problem_curvature(const FluidProblem *p)
return p->all_kappa;
}
double *fluid_problem_node_volume(const FluidProblem *p)
{
return p->node_volume;
}
double *fluid_problem_stab_param(FluidProblem *problem)
{
return problem->taup;
......
......@@ -462,6 +462,10 @@ class FluidProblem :
buf = (size*c_int).from_address(ptr)
return np.ctypeslib.as_array(buf)
def particle_uvw(self) :
"""Return the coordinates of the particles inside their element"""
return self._get_matrix("particle_uvw",self.n_particles,self._dim)
def particle_position(self) :
"""Give access to the fluid field value at the mesh nodes."""
return self._get_matrix("particle_position", self.n_particles, self._dim)
......@@ -470,6 +474,10 @@ class FluidProblem :
"""Give access to the fluid field value at the mesh nodes."""
return self._get_matrix("particle_volume", self.n_particles, 1)
def node_volume(self) :
"""Return the volume associated with each node"""
return self._get_matrix("node_volume",self.n_nodes(),1)
def _n_physicals(self):
f = self._lib.fluid_problem_private_n_physical
f.restype = c_int
......@@ -488,4 +496,3 @@ class FluidProblem :
nodes = np.ctypeslib.as_array(phys_nodes,shape=(phys_n_nodes.value,)) if phys_nodes else np.ndarray([0],np.int32)
bnd = np.ctypeslib.as_array(phys_boundaries,shape=(phys_n_boundaries.value,2)) if phys_boundaries else np.ndarray([2,0],np.int32)
return phys_name.value,phys_dim.value,phys_id.value,nodes,bnd
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment