CppAD: A C++ Algorithmic Differentiation Package
20130102
|
00001 /* $Id$ */ 00002 # ifndef CPPAD_ABORT_RECORDING_INCLUDED 00003 # define CPPAD_ABORT_RECORDING_INCLUDED 00004 00005 /* -------------------------------------------------------------------------- 00006 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell 00007 00008 CppAD is distributed under multiple licenses. This distribution is under 00009 the terms of the 00010 Eclipse Public License Version 1.0. 00011 00012 A copy of this license is included in the COPYING file of this distribution. 00013 Please visit http://www.coin-or.org/CppAD/ for information on other licenses. 00014 -------------------------------------------------------------------------- */ 00015 /* 00016 $begin abort_recording$$ 00017 $spell 00018 $$ 00019 00020 $section Abort Recording of an Operation Sequence$$ 00021 00022 $index abort, operation sequence$$ 00023 $index operation, sequence abort$$ 00024 $index sequence, operation abort$$ 00025 $index recording, abort$$ 00026 $index tape, abort recording$$ 00027 00028 $head Syntax$$ 00029 $codei%AD<%Base%>::abort_recording()%$$ 00030 00031 $head Purpose$$ 00032 Sometimes it is necessary to abort the recording of an operation sequence 00033 that started with a call of the form 00034 $codei% 00035 Independent(%x%) 00036 %$$ 00037 If such a recording is currently in progress, 00038 $code abort_recording$$ will stop the recording and delete the 00039 corresponding information. 00040 Otherwise, $code abort_recording$$ has no effect. 00041 00042 $children% 00043 example/abort_recording.cpp 00044 %$$ 00045 $head Example$$ 00046 The file 00047 $cref abort_recording.cpp$$ 00048 contains an example and test of this operation. 00049 It returns true if it succeeds and false otherwise. 00050 00051 $end 00052 ---------------------------------------------------------------------------- 00053 */ 00054 00055 00056 namespace CppAD { 00057 template <typename Base> 00058 void AD<Base>::abort_recording(void) 00059 { ADTape<Base>* tape = AD<Base>::tape_ptr(); 00060 if( tape != CPPAD_NULL ) 00061 AD<Base>::tape_manage(tape_manage_delete); 00062 } 00063 } 00064 00065 # endif