# Palabos aneurysm example: how to detect whether a given point lies in the domain or not?

Hi community,

I was able to modify the aneurysm bounce back example to carry out a simulation for my own STL geometry. My goal is to further modify this code to include a few features of my own for my geometry. For doing so, I require the use of spatial coordinates. I was wondering if there is a function which tells me if a given point with known spatial coordinates lies within the geometry or not.

Any help would be greatly appreciated. Thanks in advance.

Hi kauraajn,

sorry for the late response, I hope you found the solution for your case.

Bytheway, in your case, what you need is a voxelization. This means that you need to create a matrix with flags that tells you if a point is in or out. In palabos this process is implemented, but in the stent example, you already have a voxelized data structure like VoxelizedDomain3D. If this is not the case you can create it from a TriangleSet->DEFscaledMesh->VoxelizedDomain3D (but the process is quite technical).

When you have your voxelizedDomain you can get the voxel matrix with voxelizedDomain.getVoxelMatrix(). Inside it, you will have some flags that tell you if the considered point is in or out.

namespace voxelFlag {
static const int undetermined = 0;
static const int outside = 1;
static const int outerBorder = 2;
static const int inside = 3;
static const int innerBorder = 4;
static const int toBeInside = 5;
}

Furthermore, in the stent example, you already have an easy flag-matrix made of 0 and 1, created from the voxel matrix:
MultiScalarField3D flagMatrix((MultiBlock3D&)voxelizedDomain.getVoxelMatrix());
setToConstant(flagMatrix, voxelizedDomain.getVoxelMatrix(),
voxelFlag::inside, flagMatrix.getBoundingBox(), 1);
setToConstant(flagMatrix, voxelizedDomain.getVoxelMatrix(),
voxelFlag::innerBorder, flagMatrix.getBoundingBox(), 1);
pcout << "Number of fluid cells: " << computeSum(flagMatrix) << std::endl;

If you have physical coordinates, to compare to the voxel matrix you need to convert them in lattice units. If you are between inner and outer cells, then you need to use also the mesh to have an accurate estimation whether the point is in or out. Hope this can help you or somebody that faces the same problem.

Cheers,

Francesco

Thanks Francesco, for you reply. I figured it out.