This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TemplateHaskell #-} | |
module InlineOCCT where | |
import Data.Acquire | |
import qualified Data.Map as Map | |
import Foreign hiding (with) | |
import Language.C.Inline.Context | |
import Language.C.Inline.Cpp | |
import Language.C.Inline.HaskellIdentifier |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# HLINT ignore "Eta reduce" #-} | |
{-# LANGUAGE BlockArguments #-} | |
{-# LANGUAGE RecordWildCards #-} | |
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} | |
import Control.Lens | |
import Linear | |
import Waterfall | |
import Waterfall.IO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install cfdof | |
# make the geometry where the gases mix such that inlets with z>0 are Ar, z<0 are Air | |
# adjust rx,ry,rz below | |
# the normal speed-weighted average composition of a rectangle specified below is calculated | |
# | |
# TODO: | |
# - [ ] diffusion: reconstructPar -latestTime, then use the output velocity field with another openfoam solver for the transport equation | |
# - [ ] composition from boundary names, instead of the ad-hoc plane split based on the location of the farthest upstream point in the streamline | |
# - [ ] surrogate model (tgp?) for geometry/flow/model parameter sweeps | |
from typing import cast |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Get the name of a symbol or function call | |
#' | |
#' @param expr An expression to extract the name from. | |
#' @return A character string representing the name of the symbol or function call, or NULL if unsupported. | |
#' @examples | |
#' get_pun_name(quote(x)) # returns "x" | |
#' get_pun_name(quote(f(x))) # returns "f" | |
get_pun_name <- function(expr) { | |
if (is.symbol(expr)) { | |
return(as.character(expr)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* put this in the same directory as the wx maxima file (.wxmx) | |
load("applyN.mac"); | |
then use applyN as below | |
*/ | |
/* applyN eliminates variables from a set of equations, | |
* while maintaining expressions for the eliminated variables. | |
* | |
* For example: | |
* | |
* r : applyN([v1 + v2 = v4^2], [v1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ApplicativeDo #-} | |
{-# LANGUAGE BlockArguments #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE OverloadedLists #-} | |
{-# LANGUAGE PatternSynonyms #-} | |
-- | | |
-- | |
-- Constructive solid geometry. Not quite FRep or signed distance function. | |
module CSG where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# %% | |
using BSplineKit, LinearAlgebra, Optimization | |
using Plots | |
using RCall | |
using SplitApplyCombine | |
using Symbolics | |
@rlibrary ggplot2 | |
import OptimizationOptimisers, DataFrames |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S freecad --console | |
import os | |
import sys | |
import textwrap | |
import FreeCAD | |
import PartDesign | |
import tempfile | |
import shutil | |
from typing import TypeVar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TupleSections #-} | |
{-# HLINT ignore "Functor law" #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE ViewPatterns #-} | |
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn bmp_tptp( | |
i2c_ref: Arc<Mutex<I2C0>>, | |
sda: AnyIOPin, | |
scl: AnyIOPin, | |
config: Config, | |
) -> anyhow::Result<[f32; 4]> { | |
use bme280::i2c::BME280; | |
let i2c = i2c_ref.lock().unwrap(); | |
let i2c = RefCell::new(I2cDriver::new(i2c, sda, scl, &config)?); |
NewerOlder