') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); GitHub - makeclean/occ_faceter · GitHub
Skip to content

Repository files navigation

OCC Faceter

OCC Faceter is a coolection of tools used for the production, modification and serialisation of geometries for DAGMC

Installation

See also the installation in ./Dockerfile.

OCC Faceter has a number of dependencies, including CGAL, MOAB and OCC.

To install MOAB and its dependencies:

sudo apt install libhdf5-dev build-essential gfortran autoconf libtool liblapack-dev
git clone https://bitbucket.org/fathomteam/moab.git
cd moab
autoreconf -fi
mkdir bld; cd bld
../configure --enable-optimize --enable-shared --with-hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial --prefix=/opt/moab
make -j4
make check
sudo mkdir /opt/moab
sudo chown $USER /opt/moab
make install
cd ../..

To install OCC:

sudo apt install libocct*-dev occt*

To install occ_faceter and remaining dependencies:

sudo apt install cmake libcgal-dev libtbb-dev
git clone https://github.com/makeclean/occ_faceter.git
cd occ_faceter
mkdir build
cd build
export LD_LIBRARY_PATH=/opt/moab/lib
# build occ_faceter (to also build other tools, add -DBUILD_ALL_TOOLS=1)
cmake .. -DCMAKE_INSTALL_PREFIX=..
make -j4
make test
make install

Docker image

To build a docker image with overlap_checker and occ_faceter installed (using the Dockerfile in this directory), run:

docker build --pull --tag=occ_facet_geom .

Then to use the image, with data in the current directory appearing in /data:

docker run -v "$PWD:/data" -it occ_facet_geom

For development, use instead:

docker build --tag=inner --target inner .

Additional make_watertight tests

There are tests under development which use overlap_checker tools to prepare test geometry, and then run the DAGMC make_watertight tool on the output of occ_faceter, with the expectation that make_watertight could highlight potential problems with occ_faceter's output. See prepare-test-geometries.sh and test-with-make_watertight.sh.

Usage

After installation the bin directory should contain occ_faceter and other tools. To use occ_faceter you will need a CAD geometry, either in BREP format (output from PPP, with an associated JSON file), or a JSON list of STEP files (with associated materials).

The example below assumes you have two files which were output by PPP, test.brep and the associated test_metadata.json. The default values are used for faceting tolerance (relative to edge size) and output filename. Run ./occ_faceter --help to view the options and their default values.

mbconvert is used to convert the new h5m file into an vtk file which can then be visualized in Paraview (or Visit). occ_faceter's optional add_mat_ids flag is used, so that different materials can be given different colours in Paraview.

cd ../bin
./occ_faceter --add_mat_ids test.brep
mbconvert dagmc_not_watertight.h5m test.vtk
paraview test.vtk

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages