Skip to content

Instantly share code, notes, and snippets.

View miho's full-sized avatar

Michael Hoffer miho

View GitHub Profile
@miho
miho / KineticSolver.groovy
Created April 26, 2018 12:23
KineticSolver-UG4 component for VRL by A.Vogel and M.Hoffer
/**
* Script to perform a Kinetic Problem
*
* Author: M. Hoffer, A. Vogel
*/
import eu.mihosoft.vrl.annotation.*;
import eu.mihosoft.vrl.types.*;
import edu.gcsc.vrl.ug.api.I_ApproximationSpace;
import edu.gcsc.vrl.ug.api.I_UserNumber;
import edu.gcsc.vrl.ug.api.F_Integral;
@miho
miho / KineticLinearSolverCustom.groovy
Created April 26, 2018 12:23
KineticLinearSolver-UG4 component for VRL by A.Vogel and M.Hoffer
import edu.gcsc.vrl.ug.api.*;
import eu.mihosoft.vrl.annotation.*;
import eu.mihosoft.vrl.math.Trajectory;
import eu.mihosoft.vrl.types.CanvasRequest;
import java.io.File;
import java.io.FileFilter;
/**
* Script to perform a Kinetic Problem.
@miho
miho / AdvectionDiffusion.groovy
Last active April 26, 2018 12:24
AdvectionDiffusion-UG4 component for VRL by A.Vogel and M.Hoffer
/**
* Script to perform an Advection-Diffusion Problem
*
* Author: M. Hoffer, A. Vogel
*/
import edu.gcsc.vrl.ug.api.I_ApproximationSpace;
import edu.gcsc.vrl.ug.api.I_UserNumber;
import edu.gcsc.vrl.ug.api.I_UserVector;
import edu.gcsc.vrl.ug.api.*;
@miho
miho / StaticLinearSolverCustom.groovy
Created April 26, 2018 12:21
StaticLinearSolver-UG4 component for VRL by A.Vogel and M.Hoffer
/**
* Script to perform an Advection-Diffusion Problem
*
* Author: M. Hoffer, A. Vogel
*/
import eu.mihosoft.vrl.annotation.*;
import edu.gcsc.vrl.ug.api.F_GlobalDomainRefiner;
import edu.gcsc.vrl.ug.api.I_IRefiner;
import edu.gcsc.vrl.ug.api.I_Domain;
@miho
miho / CopyCSG.groovy
Last active April 24, 2018 09:43
Aligns copies of csg objects in a grid (depends on VCSG plugin)
package eu.mihosoft.vrl.user;
import static eu.mihosoft.vvecmath.Transform.unity;
import eu.mihosoft.vvecmath.Vector3d as Vec3d;
import eu.mihosoft.vcsg.CSG;
/**
* @author Michael Hoffer <info@michaelhoffer.de>
*/
@ComponentInfo(name="CopyCSG", category="Custom", description="Aligns copies of csg objects in a grid")
@miho
miho / File2DPlotter.groovy
Last active January 25, 2018 16:36
A simple 2df geometry & data plotter for VRL-Studio.
package eu.mihosoft.vrl.user;
/**
* A simple 2df geometry & data plotter for VRL-Studio.
*
* @author Michael Hoffer <info@michaelhoffer.de>
*/
@ComponentInfo(name="File2DPlotter", category="Custom")
class File2DPlotter implements Serializable, GlobalBackgroundPainter {
private static final long serialVersionUID=1;
package eu.mihosoft.vrl.user;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.stream.Collectors;
/**
* A simple 2d file reader for VRL-Studio.
*
* # File format:
@miho
miho / UnescapeJavaString
Created December 28, 2017 14:15 — forked from uklimaschewski/UnescapeJavaString
Unescapes a string that contains standard Java escape sequences: - \b \f \n \r \t \" \' : BS, FF, NL, CR, TAB, single and double quote - \X \XX \XXX : Octal character from 0 to 377 (that is in Hex: 0x00 to 0xFF) - \uXXXX : Hexadecimal based Unicode character
/**
* Unescapes a string that contains standard Java escape sequences.
* <ul>
* <li><strong>&#92;b &#92;f &#92;n &#92;r &#92;t &#92;" &#92;'</strong> :
* BS, FF, NL, CR, TAB, double and single quote.</li>
* <li><strong>&#92;X &#92;XX &#92;XXX</strong> : Octal character
* specification (0 - 377, 0x00 - 0xFF).</li>
* <li><strong>&#92;uXXXX</strong> : Hexadecimal based Unicode character.</li>
* </ul>
package eu.mihosoft.vrl.user;
/**
* @author Michael Hoffer <info@michaelhoffer.de>
*/
@ComponentInfo(name="MatrixPlotter", category="Custom")
class MatrixPlotter implements Serializable, GlobalBackgroundPainter {
private static final long serialVersionUID=1;
private transient double[][] M;
private transient Color minC;
package eu.mihosoft.vrl.user;
@ComponentInfo(name="TrajectoryToVector", category="Custom")
public class VectorTrajectoryToVector implements java.io.Serializable {
private static final long serialVersionUID=1L;
// add your code here
@OutputInfo(name="Vector", options="serialization=false")
public double[] convert(
@ParamInfo(name="Trajectory", style="default", options="") VectorTrajectory vt,