carputils
Doxygen code documentation for the python framework controlling openCARP
Functions
carputils.carpio.meshtool Namespace Reference

Functions

def suppress_stdout ()
 Context manager to redirect stdout. More...
 
def execute (job, cmd, msg=None, outdir=None, silent=False, stdout=None, stderr=None)
 Execute pre-assembled MeshTool command. More...
 
def generate_splitsurf (job, msh, surfs, split_ofile, silent=False, stdout=None, stderr=None)
 MESHTOOL generate a split file from a given surface. More...
 
def generate_split (job, msh, ops, split_ofile, silent=False, stdout=None, stderr=None)
 MESHTOOL generate a split file from a given surface. More...
 
def convert (job, imsh, ifmt, omsh, ofmt, silent=False, stdout=None, stderr=None)
 Python wrapper for MeshTool 'convert'. More...
 
def UVC_localize (job, msh, pts2find, scale_thr=1, ofile=None, silent=False, stdout=None, stderr=None, uvc_file=None, extra=None)
 Python wrapper for MeshTool's query idxlist_uvc. More...
 
def insert (job, cmode, submsh=None, msh=None, outmsh=None, ofmt=None, ifmt=None, idat=None, mode=None, silent=False, stdout=None, stderr=None)
 MESHTOOL. More...
 
def extract_mesh (job, msh, submsh, tags, tag_file=None, ifmt=None, ofmt=None, silent=False, stdout=None, stderr=None)
 Python wrapper for MeshTool 'extract mesh'. More...
 
def interpolate (job, cmode, omsh=None, idat=None, odat=None, imsh=None, dynpts=None, pts=None, mode=None, silent=False, stdout=None, stderr=None)
 Python wrapper for MeshTool's 'interpolate nodedata' 'interpolate elemdata' 'interpolate clouddata' 'interpolate elem2node' 'interpolate node2elem' function. More...
 
def itk (job, cmode, msh=None, min=None, max=None, size=None, surf=None, tags=None, outmsh=None, silent=False, stdout=None, stderr=None)
 Python wrapper for MeshTool's 'itk sample' 'itk <to be implemented>' function. More...
 
def extract (job, cmode, msh, surf=None, submsh=None, op=None, tags=None, tag_file=None, odat=None, mode=None, ifmt=None, ofmt=None, edge=None, ang_thr=None, coord=None, size=None, lower=None, hybrid=0, silent=False, stdout=None, stderr=None)
 
def extract_surface (job, msh, surf, op=None, tag_file=None, ifmt=None, ofmt=None, edge=None, ang_thr=None, coord=None, size=None, lower=None, hybrid=0, silent=False, stdout=None, stderr=None)
 Python wrapper for MeshTool's 'extract surface'. More...
 
def generate_mesh (job, surf, outmsh, ins_tag=None, holes=None, scale=None, bdry_layers=None, bdry_step=None, bdry_inc=None, bdry_symm=None, mode=None, prsv_bdry=None, ifmt=None, ofmt=None, silent=False, stdout=None, stderr=None)
 Python wrapper for MeshTool's 'generate mesh'. More...
 
def query (job, cmode, msh, tags=None, op=None, ifmt=None, ofmt=None, edge=None, mode=None, coord=None, uvc=None, thr=None, surf=None, silent=False, stdout=None, stderr=None)
 Python wrapper for MeshTool's 'query' function. More...
 
def smooth (job, mode, msh, outmsh=None, surf=None, thr=None, lvl=None, iter=None, smth=None, edge=None, ifmt=None, ofmt=None, tags=None, idat=None, nodal=None, odat=None, norm=None, silent=False, stdout=None, stderr=None)
 smooth Smooth one or multiple surfaces of a mesh. More...
 
def resample (job, mode, msh, outmsh, min=None, max=None, avrg=None, surf_corr=None, fix_bnd=None, postsmth=None, uniform=None, ifmt=None, ofmt=None, tags=None, silent=False, stdout=None, stderr=None)
 MESHTOOL resample volumetric or surface mesh: refine or coarsen a surface triangle mesh to fit a given edge size range parameters: -msh=<path> ... More...
 
def map (job, submsh, files, outdir, mode='m2s', info=None, mapName=None, silent=False, stdout=None, stderr=None)
 Python wrapper for MeshTool's 'map' function. More...
 
def clean_quality (job, imsh, thr=0.98, surfs=None, smth=0, iter=100, edge=0, sigma=0.05, ifmt=None, ofmt=None, outmsh=None, silent=False, stdout=None, stderr=None)
 Python wrapper for MeshTool's 'clean quality'. More...
 

Function Documentation

◆ clean_quality()

def carputils.carpio.meshtool.clean_quality (   job,
  imsh,
  thr = 0.98,
  surfs = None,
  smth = 0,
  iter = 100,
  edge = 0,
  sigma = 0.05,
  ifmt = None,
  ofmt = None,
  outmsh = None,
  silent = False,
  stdout = None,
  stderr = None 
)

Python wrapper for MeshTool's 'clean quality'.

Deform mesh elements to reach a certain quality threshold value. Provided surfaces will be preserved.

Parameters
jobjob.job.Job object
imsh(input) path to basename of the mesh
thr(input) threshold for mesh quality
surf(optional) comma separated list of surfaces (without extension) which must be preserved
smth(optional) Smoothing coefficient (default 0.00). If set to 0, mesh smoothing is turned off.
iter(optional) Number of smoothing iterations (default 100).
edge(optional) Edge detection threshold angle in degrees (default 0.00). If set to 0, edge detection is turned off.
sigma(optional) Relative vertex translation step size (default 0.05).
ifmt(optional) mesh output format.
ofmt(optional) mesh output format.
outmsh(optional) output meshname. If not specified, overwrites imsh.
silent(optional) set True to silence terminal messages
Note
The supported input formats are – carp_txt, carp_bin, vtk, vtk_bin, mmg, purk, obj, stellar, vcflow
The supported output formats are – carp_txt, carp_bin, vtk, vtk_bin, vtk_polydata, mmg, neu, obj, stellar,
vcflow, ensight_txt

◆ convert()

def carputils.carpio.meshtool.convert (   job,
  imsh,
  ifmt,
  omsh,
  ofmt,
  silent = False,
  stdout = None,
  stderr = None 
)

Python wrapper for MeshTool 'convert'.

Converts a mesh between different formats.

Parameters
jobjob.job.Job object
imsh(input) path to basename of the input mesh
ifmt(input) format of the input mesh
omsh(output) path to basename of the output mesh
ofmt(input) format of the output mesh
silent(optional) set True to silence terminal messages
Note
The supported input formats are – carp_txt, carp_bin, vtk, vtk_bin, mmg, purk, stellar
The supported output formats are – carp_txt, carp_bin, vtk, vtk_bin, vtk_polydata, mmg, stellar

◆ execute()

def carputils.carpio.meshtool.execute (   job,
  cmd,
  msg = None,
  outdir = None,
  silent = False,
  stdout = None,
  stderr = None 
)

Execute pre-assembled MeshTool command.

Parameters
jobjob.job.Job object.
cmdMeshTool command to be executed.
msgUser defined terminal message.
outdirDedicated data output directory.
silentSet true to silence commandline messages.

◆ extract()

def carputils.carpio.meshtool.extract (   job,
  cmode,
  msh,
  surf = None,
  submsh = None,
  op = None,
  tags = None,
  tag_file = None,
  odat = None,
  mode = None,
  ifmt = None,
  ofmt = None,
  edge = None,
  ang_thr = None,
  coord = None,
  size = None,
  lower = None,
  hybrid = 0,
  silent = False,
  stdout = None,
  stderr = None 
)

◆ extract_mesh()

def carputils.carpio.meshtool.extract_mesh (   job,
  msh,
  submsh,
  tags,
  tag_file = None,
  ifmt = None,
  ofmt = None,
  silent = False,
  stdout = None,
  stderr = None 
)

Python wrapper for MeshTool 'extract mesh'.

A submesh is extracted from a given mesh based on given element tags.

Parameters
jobjob.job.Job object
msh(input) path to basename of the mesh to extract from
tags(input) ","-seperated list of tags, e.g. tag1,tag2
tag_file(optional input) path to an alternative tag file, e.g. *.tags, *.btags
submsh(output) path to basename of the submesh to extract to
ifmt(optional) mesh input format
ofmt(optional) mesh output format
silent(optional) set True to silence terminal messages
Note
The supported input formats are – carp_txt, carp_bin, vtk, vtk_bin, mmg, neu, purk, obj, stellar, vcflow
The supported input formats are – carp_txt, carp_bin, vtk, vtk_bin, mmg, neu, purk, obj, stellar, vcflow

◆ extract_surface()

def carputils.carpio.meshtool.extract_surface (   job,
  msh,
  surf,
  op = None,
  tag_file = None,
  ifmt = None,
  ofmt = None,
  edge = None,
  ang_thr = None,
  coord = None,
  size = None,
  lower = None,
  hybrid = 0,
  silent = False,
  stdout = None,
  stderr = None 
)

Python wrapper for MeshTool's 'extract surface'.

Extract a sequence of surfaces defined by set operations on element tags.

Parameters
jobjob.job.Job object
msh(input) path to basename of the mesh
surf(output) list of names associated to the given operations
op(optional) list of operations to perform. By default, the surface of the full mesh is computed.
tag_file(optional) path to an alternative tag file {*.tags, *.btags}
edge(optional) <deg. angle>
surface elements connected to sharp edges will be removed. A sharp edge is defined by the nodes which connect elements with normal vectors at angles above the given threshold.
ang_thr(optional) if set, surface traversal stops when angle between current and starting normal vectors exceeds threshold
coord(optional) <xyz>:<xyz>:..
restrict surfaces to those elements reachable by surface edge-traversal from the surface vertices closest to the given coordinates. If -edge= is also provided, sharp edges will block traversal, thus limit what is reachable.
size(optional) surface edge-traversal is limited to the given radius from the initial index.
lower(optional) surface edge-traversal limitation lower size (for extracting bands).
hybrid(optional) Write hybrid quad + tri surfaces. 1 == on, 0 == off. 0 is default.
ifmt(optional) mesh input format
ofmt(optional) mesh output format. If set, the surfaces will also be written as surface meshes.
silent(optional) set True to silence terminal messages
Note
The supported input formats are – carp_txt, carp_bin, vtk, vtk_bin, mmg, neu, purk, obj, stellar, vcflow
The supported output formats are – carp_txt, carp_bin, vtk, vtk_bin, vtk_polydata, mmg, neu, obj, stellar, vcflow, ensight_txt

The format of the operations is:
tagA1,tagA2,[surfA1,surfA2..]..[+-:]tagB1,tagB2,[surfB1..]..;tagA1,..[+-:]tagB1..;..
Tag regions separated by "," will be unified into submeshes and their surface computed. Alternatively, surfaces can be provided directly by .surf surface files (only basename, no extension). If two surfaces are separated by "-", the rhs surface will be removed from the lhs surface (set difference). Similarly, using "+" will compute the surface union. If the submeshes are separated by ":", the set intersection of the two submesh surfaces will be computed. Individual operations are separated by ";".

The number of names provided with "-surf=" must match the number of operations. If no operations are provided, the surface of the whole geometry will be extracted. Individual names are separated by ",".

Further restrictions can be added to the surface extraction with the -edge= , -coord= , -size= options.

◆ generate_mesh()

def carputils.carpio.meshtool.generate_mesh (   job,
  surf,
  outmsh,
  ins_tag = None,
  holes = None,
  scale = None,
  bdry_layers = None,
  bdry_step = None,
  bdry_inc = None,
  bdry_symm = None,
  mode = None,
  prsv_bdry = None,
  ifmt = None,
  ofmt = None,
  silent = False,
  stdout = None,
  stderr = None 
)

Python wrapper for MeshTool's 'generate mesh'.

Generate a tetrahedral mesh from a list of nested triangle surfaces.

Parameters
jobjob.job.Job object
surf(input) list of paths to triangle meshes of closed surfaces
outmsh(output) path to the basename of the output mesh
ins_tag(optional) tag indices for meshed regions. Should match order of surfaces.
holes(optional) Specify coordinates of hole seed points.
scale(optional) Global edge length scaling (one value provided) OR regional edge length scaling (one value per surface provided).
bdry_layers(optional) Number of boundary element layers to include in mesh. If negative, only the boundary mesh part will be generated.
bdry_step(optional) Size of a boundary layer step, relative to the average edge length. Default is 0.10.
bdry_inc(optional) Relative boundary layer step increment. Default is 1.25
bdry_symm(optional) if 1, the boundary layer will be applied symmetrically (inward and outward) to the input surface. default is 0.
mode(optional) Volumetric element sizing mode. 0 = uniform, 1 = based on surface element size. Default is 1.
prsv_bdry(optional) 0 = remesh surface, 1 = preserve surface. Default is 1.
ifmt(optional) mesh input format. (carp_txt, carp_bin, vtk, vtk_bin, mmg, neu, purk, obj, off, gmsh, stellar, vcflow) ofmt (optional) mesh output format. (carp_txt, carp_bin, vtk, vtk_bin, vtk_polydata, mmg, neu, obj, off, stellar, vcflow, ensight_txt)
silent(optional) set True to silence terminal messages

◆ generate_split()

def carputils.carpio.meshtool.generate_split (   job,
  msh,
  ops,
  split_ofile,
  silent = False,
  stdout = None,
  stderr = None 
)

MESHTOOL generate a split file from a given surface.

parameters: msh (input) path to basename of the input mesh op (input) sequence of split operations. ifmt (optional) input format. (carp_txt, carp_bin, vtk, vtk_bin, mmg, neu, purk, obj, stellar, vcflow) split (output) path to the split list file

  The supported input formats are:

carp_txt carp_bin vtk vtk_bin mmg purk stellar

◆ generate_splitsurf()

def carputils.carpio.meshtool.generate_splitsurf (   job,
  msh,
  surfs,
  split_ofile,
  silent = False,
  stdout = None,
  stderr = None 
)

MESHTOOL generate a split file from a given surface.

parameters: msh (input) path to basename of the input mesh surf (input) list of surfaces seperated with a comma ifmt (optional) input format. (carp_txt, carp_bin, vtk, vtk_bin, mmg, neu, purk, obj, stellar, vcflow) split (output) path to the split list file

  The supported input formats are:

carp_txt carp_bin vtk vtk_bin mmg purk stellar

◆ insert()

def carputils.carpio.meshtool.insert (   job,
  cmode,
  submsh = None,
  msh = None,
  outmsh = None,
  ofmt = None,
  ifmt = None,
  idat = None,
  mode = None,
  silent = False,
  stdout = None,
  stderr = None 
)

MESHTOOL.

# -------------------------------------------------------------------------

insert submesh: a given submesh is inserted back into a mesh and written to an output mesh parameters: -submsh=<path> ... (input) path to basename of the submesh to insert from -msh=<path> ... (input) path to basename of the mesh to insert into -ofmt=<format> ... (optional) mesh output format. may be: carp_txt, carp_bin, vtk, vtk_bin, vtk_polydata, mmg, stellar -outmsh=<path> ... (output) path to basename of the output mesh

Note that the files defining the submesh must include a *.eidx and a *.nod file. This files define how elements and nodes of the submesh map back into the original mesh. The *.eidx and *.nod files are generated when using the "extract mesh" mode.

# -------------------------------------------------------------------------

insert meshdata: the fiber and tag data of a mesh is inserted into another mesh based on vertex locations. parameters: -imsh=<path> ... (input) path to basename of the mesh to insert from -msh=<path> ... (input) path to basename of the mesh to insert into -op=<path> ... (input) Operation index: 0 = only tags, 1 = only fibers, 2 = both -ifmt=<format> ... (optional) mesh input format. may be: carp_txt, carp_bin, vtk, vtk_bin, mmg, purk, stellar -ofmt=<format> ... (optional) mesh output format. may be: carp_txt, carp_bin, vtk, vtk_bin, vtk_polydata, mmg, stellar -trsp=<vec-file> ... (optional) element-based transport gradient -trsp_dist=<float> ... (optional) transport distance threshold -grad_thr=<float> ... (optional) gradient correlation threshold. Must be in (0, 1). Default is 0.99. -corr_thr=<float> ... (optional) correspondance linear search fallback threshold. Default is 1000. -con_thr=<float> ... (optional) Connectivity threshold. Required number of nodes an element of mesh1 needs to share with an element of mesh2 in order for the data to be inserted. Default is 1. -outmsh=<path> ... (output) path to basename of the output mesh

# -------------------------------------------------------------------------

insert data: data defined on a submesh is inserted back into a mesh parameters: -msh=<path> ... (input) path to basename of the mesh -submsh=<path> ... (input) path to basename of the submesh -submsh_data=<path> ... (input) path to submesh data -msh_data=<path> ... (input) path to mesh data -odat=<path> ... (output) path to output data

Note that the files defining the submesh must include a *.nod file. This file defines how the nodes of the submesh map back into the original mesh. The *.nod file is generated when using the "extract mesh" mode.

# -------------------------------------------------------------------------

insert points: points of a submesh are inserted back into a mesh and written to an output file parameters: -submsh=<path> ... (input) path to basename of the submesh to insert from -msh=<path> ... (input) path to basename of the mesh to insert into -outmsh=<path> ... (output) path to basename of the output mesh

Note that the files defining the submesh must include a *.nod file. This file defines how the nodes of the submesh map back into the original mesh. The *.nod file is generated when using the "extract mesh" mode.

# -------------------------------------------------------------------------

insert tags: insert an element data vector as new mesh element tags. parameters: -msh=<path> (input) path to basename of the mesh. -idat=<path> (input) .dat file the tags are inserted from. -outmsh=<path> (output) path to basename of the output mesh -ifmt=<format> (optional) mesh input format. -ofmt=<format> (optional) mesh output format.

# -------------------------------------------------------------------------

insert fibers: insert element fibers. parameters: -msh=<path> (input) path to basename of the mesh. -idat=<fiber>,<sheets> (input) fibers or sheets, or list of fibers followed by sheets. Files are .vec files. -mode=<int> (optional) insert mode. 0 == fibers and sheets, 1 == only fibers, 2 == only sheets. 0 is default. -outmsh=<path> (output) path to basename of the output mesh -ifmt=<format> (optional) mesh input format. -ofmt=<format> (optional) mesh output format.

◆ interpolate()

def carputils.carpio.meshtool.interpolate (   job,
  cmode,
  omsh = None,
  idat = None,
  odat = None,
  imsh = None,
  dynpts = None,
  pts = None,
  mode = None,
  silent = False,
  stdout = None,
  stderr = None 
)

Python wrapper for MeshTool's 'interpolate nodedata' 'interpolate elemdata' 'interpolate clouddata' 'interpolate elem2node' 'interpolate node2elem' function.

Examples

#interpolate nodal data from one mesh onto another

meshtool.interpolate(job, 'nodedata', omsh, imsh, idat, odat, dynpts=)

Parameters
jobjob.job.Job object
cmodechoose 'nodedata'
omsh(input) path to basename of the mesh we interpolate to
imsh(input) path to basename of the mesh we interpolate from
idat(input) path to input data.
odat(output) path to output data
dynpts(optional) dynpts describing point cloud movement
silent(optional) set True to silence terminal messages

Examples

#interpolate element data from one mesh onto another

meshtool.interpolate(job, 'elemdata', omsh, imsh, idat, odat, dynpts=None, silent=False)

Parameters
jobjob.job.Job object
cmodechoose 'elemdata'
omsh(input) path to basename of the mesh we interpolate to
imsh(input) path to basename of the mesh we interpolate from
idat(input) path to input data.
odat(output) path to output data
dynpts(optional) dynpts describing point cloud movement
silent(optional) set True to silence terminal messages

Examples

#interpolate data from a pointcloud onto a mesh using radial basis function interpolation
meshtool.interpolate(job, 'clouddata', omsh, pts, idat, odat, mode=2, dynpts=None, silent=False)
Parameters
jobjob.job.Job object
cmodechoose 'clouddata'
omsh(input) path to basename of the mesh we interpolate to
pts(input) path to the coordinates of the point cloud
idat(input) path to input data.
odat(output) path to output data.
mode(optional) Choose between localized Shepard (=0), global Shepard (=1), and RBF interpolation (=2). Default is 2.
dynpts(optional) dynpts describing point cloud movement.

Examples

#interpolate data from one mesh onto another

meshtool.interpolate(job, 'elemdata', omsh, imsh, idat, odat, dynpts=None, silent=False)

Parameters
jobjob.job.Job object
cmodechoose 'elemdata'
omsh(input) path to basename of the mesh we interpolate to
imsh(input) path to basename of the mesh we interpolate from
idat(input) path to input data.
odat(output) path to output data
dynpts(optional) dynpts describing point cloud movement
silent(optional) set True to silence terminal messages

Examples

#interpolate data from elements onto nodes

meshtool.interpolate(job, 'elem2node', omsh, idat, odat, silent=False)

Parameters
jobjob.job.Job object
cmodechoose 'elem2node'
omsh(input) path to basename of the mesh we interpolate to
idat(input) path to input data.
odat(output) path to output data
silent(optional) set True to silence terminal messages

Examples

#interpolate data from nodes onto elements

meshtool.interpolate(job, 'node2elem', omsh, idat, odat, silent=False)

Parameters
jobjob.job.Job object
cmodechoose 'node2elem'
omsh(input) path to basename of the mesh we interpolate to
idat(input) path to input data.
odat(output) path to output data
silent(optional) set True to silence terminal messages

◆ itk()

def carputils.carpio.meshtool.itk (   job,
  cmode,
  msh = None,
  min = None,
  max = None,
  size = None,
  surf = None,
  tags = None,
  outmsh = None,
  silent = False,
  stdout = None,
  stderr = None 
)

Python wrapper for MeshTool's 'itk sample' 'itk <to be implemented>' function.

Examples

#create an itk image stack from sampling surfaces

meshtool.itk(job, 'sample', msh, min, max, size, surf, outmsh, tags=,)

Parameters
jobjob.job.Job object
cmodechoose 'sample'
min(input) Path of the image stack to sample on
max(input) path to basename of the mesh we interpolate from
size(input) path to input data.
surf(output) path to output data
outmsh(output) path to output data
tags(optional) tag indices for inserted regions. Should match order of surfaces.
silent(optional) set True to silence terminal messages

◆ map()

def carputils.carpio.meshtool.map (   job,
  submsh,
  files,
  outdir,
  mode = 'm2s',
  info = None,
  mapName = None,
  silent = False,
  stdout = None,
  stderr = None 
)

Python wrapper for MeshTool's 'map' function.

   map .vtx, .surf and .neubc files to the indexing of a submesh (obtained from 'meshtool extract mesh')
Parameters
jobjob.job.Job object
submsh(input) path to basename of the submesh
files(input) files to map to submesh. Can include patterns using *
outdir(output) directory to place mapped files
mode(optional) Map mesh-to-submesh (m2s)
or vice-versa (s2m). Default is: m2s
info(optional) path to the information file mapName (optional) change the basename of the files mapped
(Default: basename of the submsh)
Note
'patterns' is a comma separated list of files or glob patterns,
e.g. mesh/endo.vtx,mesh/endo.surf,mesh/*.neubc
Any mapped files that would overwrite their source file are skipped.

◆ query()

def carputils.carpio.meshtool.query (   job,
  cmode,
  msh,
  tags = None,
  op = None,
  ifmt = None,
  ofmt = None,
  edge = None,
  mode = None,
  coord = None,
  uvc = None,
  thr = None,
  surf = None,
  silent = False,
  stdout = None,
  stderr = None 
)

Python wrapper for MeshTool's 'query' function.

Examples

# query bbox: print the bounding box of a given mesh

meshtool.query(job, 'bbox', msh, ifmt=)

Parameters
jobjob.job.Job object
cmodechoose 'bbox'
msh(input) path to basename of the mesh to query
ifmt(optional) mesh input format.
silence(optional) set True to silence terminal messages
Note
The supported input formats – carp_txt, carp_bin, vtk, vtk_bin, mmg, neu, purk, obj, stellar, vcflow

Examples

# query edges: print statistics of the node-to-node graph

meshtool.query(job, 'edges', msh, ifmt=, tags=, odat=, silent=False)

Parameters
jobjob.job.Job object
cmodechoose 'edges'
msh(input) path to basename of the mesh to query
ifmt(optional) mesh input format
tagstag1,tag2 (optional) list of region tags to compute the edge statistics on.
silent(optional) set True to silence terminal messages

Examples

# query graph: print the nodal connectivity graph

meshtool.query(job, 'graph', msh, ifmt=, silent=False)

Parameters
jobjob.job.Job object
cmodechoose 'graph'
msh(input) path to basename of the mesh to query
ifmt(optional) mesh input format.
silent(optional) set True to silence terminal messages
Note
The supported input formats – carp_txt, carp_bin, vtk, vtk_bin, mmg, neu, purk, obj, stellar, vcflow

Examples

# query idx: print indices in a proximity to a given coordinate

meshtool.query(job, 'idx', msh, coord, ifmt=, surf=, thr=, silent=False)

Parameters
jobjob.job.Job object
cmodechoose 'idx'
msh(input) path to basename of the mesh to query
coord(input) triple of x,y,z coordinates
ifmt(optional) mesh input format
surf(optional) index query is restricted to this surface
thr(optional input) threshold defining the proximity to the coordinate
silent(optional) set True to silence terminal messages
Note
The supported input formats ... carp_txt, carp_bin, vtk, vtk_bin, mmg, neu, purk, obj, stellar, vcflow

Examples

# query idxlist: generate an index list file from a given coord list file

meshtool.query(job, 'idxlist', msh, coord, ifmt=, surf=, silent=False)

Parameters
jobjob.job.Job object
cmodechoose 'idxlist'
msh(input) path to basename of the mesh to query
coord(input) the coordinates file
ifmt(optional) mesh input format
surf(optional) index query is restricted to this surface
silent(optional) set True to silence terminal messages
Note
The supported input formats ...carp_txt, carp_bin, vtk, vtk_bin, mmg, neu, purk, obj, stellar, vcflow
Parameters
queryapply 'query idx' for all coordinates in a file based on uvc coordinates parameters: -msh=<path> ... (input) path to basename of the uvc points file to perform query on (must be .uvc_pts) -coord=<file> ... (input) the uvc coordinates file holding the query points in uvc -uvc=<file> ... (optional input) path to the ucv points file (default basename.uvc_pts)
queryget the XYZ coordinates for all UVC coordinates provided in a file parameters: -msh=<path> ... (input) path to basename of the mesh to perform query on -coord=<file> ... (input) the uvc coordinates file holding the query points in uvc -uvc=<file> ... (optional input) path to the ucv points file (default basename.uvc_pts)

Examples

# query quality: print mesh quality statistics

meshtool.query(job, 'quality', msh, ifmt=, thr=, mode=0, odat=, silent=False)

Parameters
jobjob.job.Job object
cmodechoose 'quality'
msh(input) path to basename of the mesh to query
ifmt(optional) mesh input format
thr(optional) output exact number of elements with quality above this threshold
mode(optional) 0 = query only quality, 1 = query also self-intersection. Default is 0.
odat(optional) filename to store query data onto disk
Note
The supported input formats ... carp_txt, carp_bin, vtk, vtk_bin, mmg, neu, purk, obj, stellar, vcflow

Examples

# query tags: print the tags present in a given mesh

meshtool.query(job, 'tags', msh, ifmt=, silent=False)

Parameters
jobjob.job.Job object
cmodechoose 'tags'
msh(input) path to basename of the mesh to query
ifmt(optional) mesh input format
silent(optional) set True to silence terminal messages
Note
The supported input formats ... carp_txt, carp_bin, vtk, vtk_bin, mmg, neu, purk, obj, stellar, vcflow
Parameters
querycompute the nodal smoothness parameters: -msh=<path> ... (input) path to basename of the mesh to query -ifmt=<format> ... (optional) mesh input format. may be: carp_txt, carp_bin, vtk, vtk_bin, mmg, purk, stellar

◆ resample()

def carputils.carpio.meshtool.resample (   job,
  mode,
  msh,
  outmsh,
  min = None,
  max = None,
  avrg = None,
  surf_corr = None,
  fix_bnd = None,
  postsmth = None,
  uniform = None,
  ifmt = None,
  ofmt = None,
  tags = None,
  silent = False,
  stdout = None,
  stderr = None 
)

MESHTOOL resample volumetric or surface mesh: refine or coarsen a surface triangle mesh to fit a given edge size range parameters: -msh=<path> ...

(input) path to basename of the input mesh -outmsh=<path> ... (output) path to basename of the output mesh -min=<float> ... (input) min edge size -max=<float> ... (input) max edge size -avrg=<float> ... (optional) average edge size. (min, max) are derived from it. -surf_corr=<float> ... (optional) surface correlation parameter (default 0.85). Edges connecting surface nodes with surface normals correlating greater than the specified amount can be collapsed. -fix_bnd=<int> ... (optional) Fix boundary of non-closed surfaces. 0 = no, 1 = yes. Default is 1. -postsmth=<int> ... (optional) Apply conservative smoothing between resampling iterations. 0 = no, 1 = yes. Default is 1. -uniform=<int> ... (optional) Edge-refinement is applied uniformly on selected tags. 0 = no, 1 = yes. Default is 0. -ifmt=<format> ... (optional) format of the input mesh -ofmt=<format> ... (optional) format of the output mesh -tags=<tag lists> ... (optional) element tag lists specifying the regions to perform refinement on

The supported input formats are: carp_txt carp_bin vtk vtk_bin mmg purk stellar The supported output formats are: carp_txt carp_bin vtk vtk_bin vtk_polydata mmg stellar

  The tag lists have the following syntax: multiple lists are seperated by a "/",
  while the tags in one list are seperated by a "," character. The surface smoothness
  of the submesh formed by one tag list will be preserved.

◆ smooth()

def carputils.carpio.meshtool.smooth (   job,
  mode,
  msh,
  outmsh = None,
  surf = None,
  thr = None,
  lvl = None,
  iter = None,
  smth = None,
  edge = None,
  ifmt = None,
  ofmt = None,
  tags = None,
  idat = None,
  nodal = None,
  odat = None,
  norm = None,
  silent = False,
  stdout = None,
  stderr = None 
)

smooth Smooth one or multiple surfaces of a mesh.

parameters: -msh=<path> ... (input) path to basename of the mesh -surf=<path1>,<path2> ... (input) list of surfaces to smooth. -thr=<float> ... (optional) Maximum allowed element quality metric. default is 0.9. Set to 0 to disable quality checking. -lvl=<int> ... (optional) Number of volumetric element layers to to use when smoothing surfaces. Default is 2. -iter=<int> ... (optional) Number of smoothing iter (default 100). -smth=<float> ... (optional) Smoothing coefficient (default 0.15). -edge=<float> ... (optional) Normal-vector angle difference (in degrees, default 0) defining a sharp edge. If set to 0, edge detection is turned off. -ifmt=<format> ... (optional) mesh input format. (carp_txt, carp_bin, vtk, vtk_bin, mmg, purk, stellar) -ofmt=<format> ... (optional) mesh output format. (carp_txt, carp_bin, vtk, vtk_bin, vtk_polydata, mmg, stellar) -outmsh=<path> ... (output) path to basename of the output mesh

smooth Smooth a mesh (surfaces and volume). parameters: -msh=<path> ... (input) path to basename of the mesh -tags=ta1,ta2/tb1,tb2 ... (input) List of tag sets. The tags in one set have a common surface. Surfaces between different tag sets will be smoothed. Use * to include all tags, one tag per set. Use + to include all tags into one set. -thr=<float> ... (optional) Maximum allowed element quality. default is 0.9. Set to 0 to disable quality checking. -iter=<int> ... (optional) Number of smoothing iter (default 100). -smth=<float> ... (optional) Smoothing coefficient (default 0.15). -edge=<float> ... (optional) Normal-vector angle difference (in degrees, default 0) defining a sharp edge. If set to 0, edge detection is turned off. -ifmt=<format> ... (optional) mesh input format. (carp_txt, carp_bin, vtk, vtk_bin, mmg, purk, stellar) -ofmt=<format> ... (optional) mesh output format. (carp_txt, carp_bin, vtk, vtk_bin, vtk_polydata, mmg, stellar) -outmsh=<path> ... (output) path to basename of the output mesh

smooth Smooth data. parameters: -msh=<path> ... (input) path to basename of the mesh -idat=<path> ... (input) path to the input data file -iter=<int> ... (optional) Number of smoothing iter (default 100). -smth=<float> ... (optional) Smoothing coefficient (default 0.15). -nodal=<0|1> ... (optional) Set data representation: 0 = element data, 1 = nodal data. (default is 1). -ifmt=<format> ... (optional) mesh input format. may be: carp_txt, carp_bin, vtk, vtk_bin, mmg, purk, stellar -odat=<path> ... (output) path to the output data file

◆ suppress_stdout()

def carputils.carpio.meshtool.suppress_stdout ( )

Context manager to redirect stdout.

◆ UVC_localize()

def carputils.carpio.meshtool.UVC_localize (   job,
  msh,
  pts2find,
  scale_thr = 1,
  ofile = None,
  silent = False,
  stdout = None,
  stderr = None,
  uvc_file = None,
  extra = None 
)

Python wrapper for MeshTool's query idxlist_uvc.

Parameters
msh(input) path to basename of the input mesh. Mesh must contain +'.pts_t' file describing the UVC Combined Coordinates.
pts2find(input) list of uvcpts to localize with included thresholds. Format = {z,rho,phi,ven,thr_rho,thr_ep}
scale_thr(output) scaling the sizing of the stimulus sites.
ofile(optional) format of the output mesh
silent(optional) set True to silence terminal messages
Returns
UVC data.