⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtc.c

📁 OpenFVM-v1.1 open source cfd code
💻 C
字号:
/****************************************************************************//*                                  rtc.c                                   *//****************************************************************************//*                                                                          *//* Residual Termination Control                                             *//*                                                                          *//* Copyright (C) 1992-1996 Tomas Skalicky. All rights reserved.             *//*                                                                          *//****************************************************************************//*                                                                          *//*        ANY USE OF THIS CODE CONSTITUTES ACCEPTANCE OF THE TERMS          *//*              OF THE COPYRIGHT NOTICE (SEE FILE COPYRGHT.H)               *//*                                                                          *//****************************************************************************/#include <stddef.h>#include "rtc.h"#include "errhandl.h"#include "elcmp.h"#include "operats.h"#include "copyrght.h"/* accuracy for Residual Termination Control */static double RTCEps = 1e-8;/* auxiliary procedure to be performed by Residual Termination Control */static RTCAuxProcType RTCAuxProc = NULL;/* number of iterations performed during last call of a iteration method */static int LastNoIter = 0;/* accuracy reached during last call of a iteration method */static double LastAcc = 0.0;void SetRTCAccuracy(double Eps)/* set accuracy for the RTC */{    RTCEps = Eps;}void SetRTCAuxProc(RTCAuxProcType AuxProc)/* set auxiliary procedure of RTC */{    RTCAuxProc = AuxProc;}Boolean RTCResult(int Iter, double rNorm, double bNorm, IterIdType IterId)/* get result of RTC */{    Boolean Result;    if (LASResult() == LASOK) {        if (rNorm < RTCEps * bNorm || (IsZero(bNorm) && IsOne(1.0 + rNorm)))            Result = True;        else            Result = False;        LastNoIter = Iter;        if (!IsZero(bNorm))            LastAcc = rNorm / bNorm;        else            LastAcc = 1.0;        if (RTCAuxProc != NULL)            (*RTCAuxProc)(Iter, rNorm, bNorm, IterId);    } else {        Result = True;    }    return(Result);}int GetLastNoIter()/* get number of iterations performed during last call of a iteration method */{    return(LastNoIter);}double GetLastAccuracy()/* get accuracy reached during last call of a iteration method */{    return(LastAcc);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -