FEDEM Solver  R8.0
Source code of the dynamics solver
Functions
testExternal.C File Reference

Test program for external functions in the dynamics solver. More...

#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include "../solverInterface.h"
Include dependency graph for testExternal.C:

Functions

bool readFsiFile (const char *, const char *, std::string &)
 Utility function to read a solver input file into a string variable. More...
 
int compareResponse (const char *, const char *, double, int=0)
 Utility function to compare two ASCII files with numerical data. More...
 
static double extFunc (int id, double x)
 Hard-coded external function evaluations to test against. More...
 
static void printOut (std::ostream &os, bool formatted, double time, const double *outputs, size_t nOut)
 Helper to print out response data to the given stream for a time step. More...
 
int main (int argc, char **argv)
 Test program for external functions in the dynamics solver. More...
 

Detailed Description

Test program for external functions in the dynamics solver.

Author
Knut Morten Okstad, Fedem Technology AS
Date
5 Dec 2016

Function Documentation

◆ compareResponse()

int compareResponse ( const char *  fn1,
const char *  fn2,
double  eps,
int  skip 
)

Utility function to compare two ASCII files with numerical data.

Parameters
[in]fn1Path to the first file
[in]fn2Path to the second file (with reference data)
[in]epsComparison tolerance
[in]skipNumber of initial lines to skip coomparison for
Here is the caller graph for this function:

◆ extFunc()

static double extFunc ( int  id,
double  x 
)
static

Hard-coded external function evaluations to test against.

◆ main()

int main ( int  argc,
char **  argv 
)

Test program for external functions in the dynamics solver.

Here is the call graph for this function:

◆ printOut()

static void printOut ( std::ostream &  os,
bool  formatted,
double  time,
const double *  outputs,
size_t  nOut 
)
static

Helper to print out response data to the given stream for a time step.

◆ readFsiFile()

bool readFsiFile ( const char *  cwd,
const char *  fname,
std::string &  chfsi 
)

Utility function to read a solver input file into a string variable.

Parameters
[in]cwdCurrent working directory
[in]fnamePath to the solver input file on disk
[out]chfsiText string containing the compressed file content

All blank lines and comment lines are ignored, and all white spaces are replaced by a single space character, to make the string more compact. A dollar-sign ($) is appended at the end of each line instead of the newline character, since the latter is not so well handled by the Fortran routines that read the solver input.

Here is the caller graph for this function: