Skip to content

Commit

Permalink
1st commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yannrichet committed Oct 9, 2023
0 parents commit 906dfc5
Show file tree
Hide file tree
Showing 28 changed files with 11,510 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Java CI

on:
push:
branches: [ master ]
tags: [ 'v*.*' ]
pull_request:
branches: [ master ]

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
java: [ 8 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
java-package: jdk
- run: |
WD=$PWD
cd ..
git clone https://github.com/Funz/funz-profile
cd $WD
shell: bash
- run: ant -noinput -buildfile build.xml test

release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 1.8
java-package: jdk
- run: |
WD=$PWD
cd ..
git clone https://github.com/Funz/funz-profile
cd $WD
- run: |
ant clean dist
cd dist; zip -r ../plugin-Cathare.zip *; cd ..
ant install
zip -r Funz-Cathare.zip Funz-Cathare
- uses: actions/upload-artifact@v2
with:
path: dist
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./*-Cathare.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}



21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**/*-private
/**/log.txt
/**/*history

/build/
/tmp/
/nbproject/
/dist/
/test/

/*.png
/*.html
/*.log
/*.zip
/*.out
/*.csv
/*.txt
/*.Rout
/*.Rdata
/*.Rmd
/*.exec
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[![.github/workflows/ant.yml](https://github.com/Funz/plugin-Cathare/actions/workflows/ant.yml/badge.svg)](https://github.com/Funz/plugin-Cathare/actions/workflows/ant.yml)

# Funz plugin: Cathare

This plugin is dedicated to launch Cathare calculations from Funz.
It supports the following syntax and features:

* Input
* main file
* PERMINIT file (if available)
* PERMINIT postpro file (if available)
* postpro file
* reader mask files (if available)
* parameter syntax:
* variable syntax: `$(...)`
* formula syntax: `@{...}`
* comment char: `*`
* example input files:
* main file
```
REALC BOTTOM P $(p~57.)D5
TL $(tl~[232.,242.])
HVSAT
ALFA 1.0D-5
VL 1.0D-5
VV 1.0D-5;
```
* will identify input:
* p, expected to default value 57.0
* tl, expected to vary inside [232,242]
* Output
* file type supported: Cathare FORT07 file



![Analytics](https://ga-beacon.appspot.com/UA-109580-20/plugin-Cathare)
20 changes: 20 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<project name="plugin-Cathare" default="test" basedir=".">

<property name="code.name" value="Cathare" />
<property name="install.dir" value="${basedir}/Funz-${code.name}" />

<property name="build_plugin.xml" location="../funz-profile/build_plugin.xml" />
<import file="${build_plugin.xml}"/>

<property file="${code.name}.properties"/>

<target name="dist" depends="dist-iopluginjar"/> <!-- dist-ioplugin: copy the plugin jar files -->

<target name="test" depends="test-iopluginjar"/> <!-- test-iopluginjar: test the java plugin -->

<target name="install" depends="install-plugin"/> <!-- test-ioplugin: test the plugin ascii files -->

<target name="super.clean" depends="clean"/>
<target name="super.run-reference-cases" depends="run-reference-cases"/>

</project>
74 changes: 74 additions & 0 deletions src/main/java/org/funz/Cathare/CathareCPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package org.funz.Cathare;

import java.io.File;
import java.io.FileFilter;
import java.util.Properties;
import org.funz.calculator.plugin.CodeLauncher;
import org.funz.calculator.plugin.DataChannel;
import org.funz.calculator.plugin.DefaultCalculatorPlugin;
import org.funz.calculator.plugin.DefaultCodeLauncher;
import org.funz.calculator.plugin.OutputReader;
import org.funz.util.ParserUtils;

public class CathareCPlugin extends DefaultCalculatorPlugin {


public CodeLauncher createCodeLauncher(Properties variables, DataChannel channel) {
super.createCodeLauncher(variables, channel);
return new CathareLauncher(this);
}

private class CathareLauncher extends DefaultCodeLauncher {

CathareLauncher(CathareCPlugin plugin) {
super(plugin);
_progressSender = new CathareOutReader(this);
}

private class CathareOutReader extends OutputReader {

public CathareOutReader(CathareLauncher l) {
super(l);
_information = "?";
}

public void run() {
if (getDataChannel() == null) {
return;
}

while (!_stopMe) {
synchronized (this) {
try {
wait(1000);
} catch (Exception e) {
}
}

File[] outfiles = _dir.listFiles(new FileFilter() {

public boolean accept(File pathname) {
return pathname.getName().equals("out.txt");
}
});

if (outfiles == null || outfiles.length < 1) {
_information = "?";
} else {

File outfile = outfiles[0];

_information = ParserUtils.getLastFullLine(outfile);

}

if (_information != null && _information.length() > 0) {
if (!getDataChannel().sendInfomationLineToConsole(_information)) {
break;
}
}
}
}
}
}
}
Loading

0 comments on commit 906dfc5

Please sign in to comment.