{"id":4717,"date":"2020-08-19T07:49:48","date_gmt":"2020-08-19T06:49:48","guid":{"rendered":"http:\/\/roboblog.fatal-fury.de\/?p=4717"},"modified":"2020-08-19T11:55:39","modified_gmt":"2020-08-19T10:55:39","slug":"fortran-assert","status":"publish","type":"post","link":"http:\/\/roboblog.fatal-fury.de\/?p=4717","title":{"rendered":"Fortran assert"},"content":{"rendered":"<p>assert.h<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n#ifdef NDEBUG\r\n#define assert(expr)\r\n#else\r\n#define assert(expr)    call assertion(expr)\r\n#endif\r\n<\/pre>\n<p>assertion.F90<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nmodule assert_m\r\n  contains\r\n  \r\n  subroutine assertion(cond)\r\n    implicit none\r\n    logical, intent(in) :: cond\r\n    real, volatile :: r\r\n    r = 1.0\r\n    if (.not. cond) r = r \/ 0.0\r\n  end subroutine assertion\r\n\r\nend module\r\n\r\n<\/pre>\n<p>Beispiel:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n#include &quot;assert.h&quot;\r\n\r\n    use assert_m\r\n\r\n\r\n    subroutine VBEST(H, RH, KZ, DFM, Q, V0, V)\r\n      implicit none\r\n      real, intent(in) :: H\r\n      real, intent(in) :: RH\r\n      integer, intent(in) :: KZ\r\n      real, intent(in) :: DFM\r\n      real, intent(in) :: Q\r\n\r\n      assert(Q == Q)\r\n      assert(H &gt;= 0)\r\n      assert(RH &gt;= 0)\r\n      assert(KZ &gt;= 1)\r\n      assert(DFM &gt; 0)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>assert.h #ifdef NDEBUG #define assert(expr) #else #define assert(expr) call assertion(expr) #endif assertion.F90 module assert_m contains subroutine assertion(cond) implicit none logical, intent(in) :: cond real, volatile :: r r = 1.0 if (.not. cond) r = r \/ 0.0 end subroutine assertion end module Beispiel: #include &quot;assert.h&quot; use assert_m subroutine VBEST(H, RH, KZ, DFM, Q, V0, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[30],"class_list":["post-4717","post","type-post","status-publish","format-standard","hentry","category-allgemein","tag-fortran"],"_links":{"self":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts\/4717","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4717"}],"version-history":[{"count":3,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts\/4717\/revisions"}],"predecessor-version":[{"id":4720,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=\/wp\/v2\/posts\/4717\/revisions\/4720"}],"wp:attachment":[{"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4717"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/roboblog.fatal-fury.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}