DOLFIN User Manual - FEniCS Project
DOLFIN User Manual - FEniCS Project DOLFIN User Manual - FEniCS Project
DOLFIN User ManualHoffman, Jansson, Logg, Wellsdolfin assert(check);This macro accepts a boolean expression and if the expression evaluates tofalse, an error message is displayed, including the file, function name andline number of the assertion, and a segmentation fault is raised (to enableeasy attachment to a debugger). The following examples illustrate the useof dolfin assert():dolfin_assert(i >= 0);dolfin_assert(i < n);dolfin_assert(cell.type() == Cell::triangle);dolfin_assert(cell.type() == Cell::tetrahedron);Note that assertions are only active when compiling DOLFIN and yourprogram with DEBUG defined (configure option --enable-debug or compilerflag -DDEBUG). Otherwise, the macro dolfin assert() expands to nothing,meaning that liberal use of assertions does not affect performance, since assertionsare only present during development and debugging.10.4 Task notificationThe two functions dolfin begin() and dolfin end() available in the dolfinname space can be used to notify the DOLFIN log system about the beginningand end of a task:void dolfin_begin();void dolfin_end();Alternatively, a string message (or a formatting string with optional arguments)can be supplied:68
DOLFIN User ManualHoffman, Jansson, Logg, Wellsvoid dolfin_begin(const char* message, ...);void dolfin_end(const char* message, ...);These functions enable the DOLFIN log system to display messages, warningsand errors hierarchically, by automatically indenting the output producedbetween calls to dolfin begin() and dolfin end(). A program maycontain an arbitrary number of nested tasks.10.5 Progress barsThe DOLFIN log system provides the class Progress for simple creation ofprogress sessions. A progress session automatically displays the progress ofa computation using a progress bar.If the number of steps of a computation is known, a progress session shouldbe defined in terms of the number of steps and updated in each step of thecomputation as illustrated by the following example:Progress p(‘‘Assembling’’, mesh.noCells());for (CellIterator c(mesh); !c.end(); ++c){...p++;}It is also possible to specify the step number explicitly by assigning an integerto the progress session:Progress p(‘‘Iterating over vector’’, x.size())for (uint i = 0; i < x.size(); i++){...69
- Page 18 and 19: DOLFIN User ManualHoffman, Jansson,
- Page 20 and 21: DOLFIN User ManualHoffman, Jansson,
- Page 22 and 23: DOLFIN User ManualHoffman, Jansson,
- Page 25 and 26: Chapter 3Linear algebra◮ Develope
- Page 27 and 28: DOLFIN User ManualHoffman, Jansson,
- Page 29 and 30: Chapter 4The mesh◮ Developer’s
- Page 31 and 32: DOLFIN User ManualHoffman, Jansson,
- Page 33 and 34: Chapter 5Functions◮ Developer’s
- Page 35 and 36: DOLFIN User ManualHoffman, Jansson,
- Page 37 and 38: DOLFIN User ManualHoffman, Jansson,
- Page 39 and 40: DOLFIN User ManualHoffman, Jansson,
- Page 41 and 42: DOLFIN User ManualHoffman, Jansson,
- Page 43: Chapter 6Ordinary differential equa
- Page 46 and 47: DOLFIN User ManualHoffman, Jansson,
- Page 48 and 49: DOLFIN User ManualHoffman, Jansson,
- Page 50 and 51: DOLFIN User ManualHoffman, Jansson,
- Page 53 and 54: Chapter 8Nonlinear solver◮ Develo
- Page 55: DOLFIN User ManualHoffman, Jansson,
- Page 58 and 59: DOLFIN User ManualHoffman, Jansson,
- Page 60 and 61: DOLFIN User ManualHoffman, Jansson,
- Page 62 and 63: DOLFIN User ManualHoffman, Jansson,
- Page 65 and 66: Chapter 10The log systemDOLFIN prov
- Page 67: DOLFIN User ManualHoffman, Jansson,
- Page 71: DOLFIN User ManualHoffman, Jansson,
- Page 74 and 75: DOLFIN User ManualHoffman, Jansson,
- Page 76 and 77: DOLFIN User ManualHoffman, Jansson,
- Page 78 and 79: DOLFIN User ManualHoffman, Jansson,
- Page 80 and 81: DOLFIN User ManualHoffman, Jansson,
- Page 82 and 83: DOLFIN User ManualHoffman, Jansson,
- Page 85: Bibliography[1] Cygwin, 2005. http:
- Page 88 and 89: v 2 v 0 = (0, 0)DOLFIN User ManualH
- Page 90 and 91: DOLFIN User ManualHoffman, Jansson,
- Page 92 and 93: DOLFIN User ManualHoffman, Jansson,
- Page 94 and 95: DOLFIN User ManualHoffman, Jansson,
- Page 96 and 97: DOLFIN User ManualHoffman, Jansson,
- Page 98 and 99: DOLFIN User ManualHoffman, Jansson,
- Page 100 and 101: DOLFIN User ManualHoffman, Jansson,
- Page 102 and 103: DOLFIN User ManualHoffman, Jansson,
- Page 105 and 106: Appendix CContributing codeIf you h
- Page 107 and 108: DOLFIN User ManualHoffman, Jansson,
- Page 109 and 110: Appendix DLicenseDOLFIN is licensed
- Page 111 and 112: DOLFIN User ManualHoffman, Jansson,
- Page 113 and 114: DOLFIN User ManualHoffman, Jansson,
- Page 115: DOLFIN User ManualHoffman, Jansson,
<strong>DOLFIN</strong> <strong>User</strong> <strong>Manual</strong>Hoffman, Jansson, Logg, Wellsvoid dolfin_begin(const char* message, ...);void dolfin_end(const char* message, ...);These functions enable the <strong>DOLFIN</strong> log system to display messages, warningsand errors hierarchically, by automatically indenting the output producedbetween calls to dolfin begin() and dolfin end(). A program maycontain an arbitrary number of nested tasks.10.5 Progress barsThe <strong>DOLFIN</strong> log system provides the class Progress for simple creation ofprogress sessions. A progress session automatically displays the progress ofa computation using a progress bar.If the number of steps of a computation is known, a progress session shouldbe defined in terms of the number of steps and updated in each step of thecomputation as illustrated by the following example:Progress p(‘‘Assembling’’, mesh.noCells());for (CellIterator c(mesh); !c.end(); ++c){...p++;}It is also possible to specify the step number explicitly by assigning an integerto the progress session:Progress p(‘‘Iterating over vector’’, x.size())for (uint i = 0; i < x.size(); i++){...69