41 #include <boost/shared_ptr.hpp>
42 #include <boost/optional.hpp>
43 #include <boost/operators.hpp>
45 #include <boost/filesystem/operations.hpp>
46 #include <boost/filesystem/fstream.hpp>
48 #include <boost/archive/binary_oarchive.hpp>
49 #include <boost/archive/binary_iarchive.hpp>
51 #include <boost/serialization/split_member.hpp>
52 #include <boost/serialization/utility.hpp>
53 #include <boost/serialization/map.hpp>
54 #include <boost/serialization/string.hpp>
58 #include <feel/feelcore/feel.hpp>
59 #include <feel/feelcore/context.hpp>
65 #include <feel/feeldiscr/functionspace.hpp>
71 namespace fs = boost::filesystem;
76 STEP_HAS_DATA = ( 1<<1 ),
77 STEP_ON_DISK = ( 1<<2 ),
78 STEP_IN_MEMORY = ( 1<<3 ),
79 STEP_OVERWRITE = ( 1<<10 )
81 template<
typename A0,
typename A1,
typename A2,
typename A3,
typename A4>
class FunctionSpace;
89 template<
typename MeshType,
int N = 1>
97 typedef MeshType mesh_type;
98 typedef boost::shared_ptr<mesh_type> mesh_ptrtype;
107 typedef boost::shared_ptr<scalar_p0_space_type> scalar_p0_space_ptrtype;
108 typedef boost::shared_ptr<vector_p0_space_type> vector_p0_space_ptrtype;
109 typedef boost::shared_ptr<tensor2_p0_space_type> tensor2_p0_space_ptrtype;
110 typedef boost::shared_ptr<scalar_p1_space_type> scalar_p1_space_ptrtype;
111 typedef boost::shared_ptr<vector_p1_space_type> vector_p1_space_ptrtype;
112 typedef boost::shared_ptr<tensor2_p1_space_type> tensor2_p1_space_ptrtype;
115 typedef typename scalar_p0_space_type::element_type element_scalar_type;
116 typedef typename vector_p0_space_type::element_type element_vector_type;
117 typedef typename tensor2_p0_space_type::element_type element_tensor2_type;
118 typedef typename scalar_p1_space_type::element_type nodal_scalar_type;
119 typedef typename vector_p1_space_type::element_type nodal_vector_type;
120 typedef typename tensor2_p1_space_type::element_type nodal_tensor2_type;
128 boost::equality_comparable<Step>,
129 boost::less_than_comparable<Step>
137 typedef MeshType mesh_type;
138 typedef boost::shared_ptr<mesh_type> mesh_ptrtype;
147 typedef boost::shared_ptr<scalar_p0_space_type> scalar_p0_space_ptrtype;
148 typedef boost::shared_ptr<vector_p0_space_type> vector_p0_space_ptrtype;
149 typedef boost::shared_ptr<tensor2_p0_space_type> tensor2_p0_space_ptrtype;
150 typedef boost::shared_ptr<scalar_p1_space_type> scalar_p1_space_ptrtype;
151 typedef boost::shared_ptr<vector_p1_space_type> vector_p1_space_ptrtype;
152 typedef boost::shared_ptr<tensor2_p1_space_type> tensor2_p1_space_ptrtype;
155 typedef typename scalar_p0_space_type::element_type element_scalar_type;
156 typedef typename vector_p0_space_type::element_type element_vector_type;
157 typedef typename tensor2_p0_space_type::element_type element_tensor2_type;
158 typedef typename scalar_p1_space_type::element_type nodal_scalar_type;
159 typedef typename vector_p1_space_type::element_type nodal_vector_type;
160 typedef typename tensor2_p1_space_type::element_type nodal_tensor2_type;
162 typedef std::map<std::string, std::pair<scalar_type,bool> > map_scalar_type;
163 typedef std::map<std::string, std::pair<complex_type,bool> > map_complex_type;
164 typedef std::map<std::string, nodal_scalar_type> map_nodal_scalar_type;
165 typedef std::map<std::string, nodal_vector_type> map_nodal_vector_type;
166 typedef std::map<std::string, nodal_tensor2_type> map_nodal_tensor2_type;
167 typedef std::map<std::string, element_scalar_type> map_element_scalar_type;
168 typedef std::map<std::string, element_vector_type> map_element_vector_type;
169 typedef std::map<std::string, element_tensor2_type> map_element_tensor2_type;
171 typedef typename map_scalar_type::iterator scalar_iterator;
172 typedef typename map_scalar_type::const_iterator scalar_const_iterator;
174 typedef typename map_complex_type::iterator complex_iterator;
175 typedef typename map_complex_type::const_iterator complex_const_iterator;
177 typedef typename map_nodal_scalar_type::iterator nodal_scalar_iterator;
178 typedef typename map_nodal_scalar_type::const_iterator nodal_scalar_const_iterator;
180 typedef typename map_nodal_vector_type::iterator nodal_vector_iterator;
181 typedef typename map_nodal_vector_type::const_iterator nodal_vector_const_iterator;
183 typedef typename map_nodal_tensor2_type::iterator nodal_tensor2_iterator;
184 typedef typename map_nodal_tensor2_type::const_iterator nodal_tensor2_const_iterator;
186 typedef typename map_element_scalar_type::iterator element_scalar_iterator;
187 typedef typename map_element_scalar_type::const_iterator element_scalar_const_iterator;
189 typedef typename map_element_vector_type::iterator element_vector_iterator;
190 typedef typename map_element_vector_type::const_iterator element_vector_const_iterator;
192 typedef typename map_element_tensor2_type::iterator element_tensor2_iterator;
193 typedef typename map_element_tensor2_type::const_iterator element_tensor2_const_iterator;
218 return M_state.test( STEP_NEW );
227 return M_state.test( STEP_HAS_DATA );
236 return M_state.test( STEP_ON_DISK );
245 return M_state.test( STEP_IN_MEMORY );
292 scalar_const_iterator
beginScalar()
const {
return M_scalar.begin(); }
297 scalar_const_iterator
endScalar()
const {
return M_scalar.end(); }
304 scalar_type
scalar( std::string
const& __n )
const
306 if ( M_scalar.find( __n ) == M_scalar.end() )
308 std::ostringstream __err;
309 __err <<
"invalid scalar value name " << __n;
310 throw std::logic_error( __err.str() );
313 return M_scalar.find( __n )->second.first;
324 if ( M_nodal_scalar.find( __n ) == M_nodal_scalar.end() )
326 std::ostringstream __err;
327 __err <<
"invalid nodal scalar field name " << __n;
328 throw std::logic_error( __err.str() );
331 return M_nodal_scalar.find( __n )->second.first;
341 if ( M_nodal_vector.find( __n ) == M_nodal_vector.end() )
343 std::ostringstream __err;
344 __err <<
"invalid nodal vector field name " << __n;
345 throw std::logic_error( __err.str() );
348 return M_nodal_vector.find( __n )->second;
358 if ( M_nodal_tensor2.find( __n ) == M_nodal_tensor2.end() )
360 std::ostringstream __err;
361 __err <<
"invalid nodal tensor2 field name " << __n;
362 throw std::logic_error( __err.str() );
365 return M_nodal_tensor2.find( __n )->second;
375 if ( M_element_scalar.find( __n ) == M_element_scalar.end() )
377 std::ostringstream __err;
378 __err <<
"invalid element scalar field name " << __n;
379 throw std::logic_error( __err.str() );
382 return M_element_scalar.find( __n )->second;
392 if ( M_element_vector.find( __n ) == M_element_vector.end() )
394 std::ostringstream __err;
395 __err <<
"invalid element vector field name " << __n;
396 throw std::logic_error( __err.str() );
399 return M_element_vector.find( __n )->second;
409 if ( M_element_tensor2.find( __n ) == M_element_tensor2.end() )
411 std::ostringstream __err;
412 __err <<
"invalid element tensor2 field name " << __n;
413 throw std::logic_error( __err.str() );
416 return M_element_tensor2.find( __n )->second;
427 executeState( __st );
428 showMe(
"Step::setState" );
430 void setMesh( mesh_ptrtype
const& __m )
432 DVLOG(2) <<
"[TimeSet::setMesh] setMesh start\n";
435 M_state.set( STEP_HAS_DATA|STEP_IN_MEMORY );
436 M_state.clear( STEP_ON_DISK );
437 DVLOG(2) <<
"[TimeSet::setMesh] setMesh start\n";
440 void addScalar( std::string
const&
name, scalar_type
const& __s,
bool cst =
false )
442 M_scalar[
name] = std::make_pair( __s, cst );
443 M_state.set( STEP_HAS_DATA|STEP_IN_MEMORY );
444 M_state.clear( STEP_ON_DISK );
447 void addComplex( std::string
const& name, complex_type
const& __s )
449 M_complex[
name] = __s;
450 M_state.set( STEP_HAS_DATA|STEP_IN_MEMORY );
451 M_state.clear( STEP_ON_DISK );
454 void addNodal( nodal_scalar_type
const& __s )
456 M_nodal_scalar[__s.name()] = __s;
457 M_state.set( STEP_HAS_DATA|STEP_IN_MEMORY );
458 M_state.clear( STEP_ON_DISK );
461 void addNodal( nodal_vector_type
const& __s )
463 M_nodal_vector[__s.name()] = __s;
464 M_state.set( STEP_HAS_DATA|STEP_IN_MEMORY );
465 M_state.clear( STEP_ON_DISK );
469 addRegions( std::string prefix =
"" )
471 VLOG(1) <<
"[timeset] Adding regions...\n";
472 if ( !M_ts->M_scalar_p0 )
474 VLOG(1) <<
"[timeset] creating space...\n";
475 if ( Environment::worldComm().numberOfSubWorlds() > 1 )
477 auto wc = std::vector<WorldComm>( 1, Environment::worldComm().subWorld(Environment::worldComm().numberOfSubWorlds()) );
482 auto wc = std::vector<WorldComm>( 1, Environment::worldComm() );
485 M_scalar_p0 = M_ts->M_scalar_p0;
487 VLOG(1) <<
"[timeset] adding pid...\n";
488 if ( prefix.empty() )
489 add(
"pid", regionProcess( M_scalar_p0 ) );
491 add( prefix +
"." +
"pid", regionProcess( M_scalar_p0 ) );
497 template<
typename FunctionType>
498 void add( std::initializer_list<std::string> __n, FunctionType
const& func )
500 std::vector<std::string> str( __n );
501 add_( str, func, mpl::bool_<(FunctionType::functionspace_type::nSpaces>1)>() );
504 template<
typename FunctionType>
505 void add( std::vector<std::string>
const& __n, FunctionType
const& func )
507 add_( __n, func, mpl::bool_<(FunctionType::functionspace_type::nSpaces>1)>() );
509 template<
typename FunctionType>
510 void add( std::string
const& __n, FunctionType
const& func )
512 add_( __n, func, mpl::bool_<(FunctionType::functionspace_type::nSpaces>1)>() );
515 template<
typename TSet>
516 struct AddFunctionProduct
518 AddFunctionProduct( TSet& tset ) : M_tset( tset ) {}
523 operator()( T
const& fun )
const
525 LOG(INFO) <<
"export " << fun.name() <<
" ...\n";
526 M_tset.add_( fun.name(), fun, mpl::bool_<false>() );
529 template<
typename FunctionType>
530 void add_( std::vector<std::string>
const& __n, FunctionType
const& func, mpl::bool_<true> )
532 std::vector<std::string> s = __n;
533 FEELPP_ASSERT( s.size() == FunctionType::functionspace_type::nSpaces );
535 fusion::for_each( subelements(func,s), AddFunctionProduct<step_type>( *
this ) );
537 template<
typename FunctionType>
538 void add_( std::string
const& __n, FunctionType
const& func, mpl::bool_<true> )
540 std::vector<std::string> s;
542 for(
int i=0; i<FunctionType::functionspace_type::nSpaces; i++)
544 std::ostringstream i_str;
546 s.push_back(__n + i_str.str());
548 FEELPP_ASSERT( s.size() == FunctionType::functionspace_type::nSpaces );
550 fusion::for_each( subelements(func,s), AddFunctionProduct<step_type>( *
this ) );
552 template<
typename FunctionType>
553 void add_( std::string
const& __n, FunctionType
const& func, mpl::bool_<false> )
555 typedef typename mpl::or_<is_shared_ptr<FunctionType>, boost::is_pointer<FunctionType> >::type is_ptr_or_shared_ptr;
556 add( __n,func,is_ptr_or_shared_ptr() );
558 template<
typename FunctionType>
559 void add( std::string
const& __n, std::string
const& __fname, FunctionType
const& func )
561 typedef typename mpl::or_<is_shared_ptr<FunctionType>, boost::is_pointer<FunctionType> >::type is_ptr_or_shared_ptr;
562 add( __n,__fname,func,is_ptr_or_shared_ptr() );
565 template<
typename FunctionType>
566 void add( std::string
const& __n, FunctionType
const& func, mpl::bool_<true> )
568 add( __n,*func, mpl::bool_<false>() );
570 template<
typename FunctionType>
571 void add( std::string
const& __n, std::string
const& __fname, FunctionType
const& func, mpl::bool_<true> )
573 add( __n,__fname,*func, mpl::bool_<false>() );
576 template<
typename FunctionType>
577 void add( std::string
const& __n, FunctionType
const& func, mpl::bool_<false> )
579 add( __n, __n, func, mpl::bool_<false>(), mpl::bool_<FunctionType::is_continuous || FunctionType::functionspace_type::continuity_type::is_discontinuous_locally>() );
581 template<
typename FunctionType>
582 void add( std::string
const& __n, std::string
const& __fname, FunctionType
const& func, mpl::bool_<false> )
584 add( __n, __fname, func, mpl::bool_<false>(), mpl::bool_<FunctionType::is_continuous || FunctionType::functionspace_type::continuity_type::is_discontinuous_locally>() );
586 template<
typename FunctionType>
587 void add( std::string
const& __n, std::string
const& __fname, FunctionType
const& func, mpl::bool_<false>, mpl::bool_<true> )
590 if ( FunctionType::is_scalar )
594 if ( !M_ts->M_scalar_p1 )
596 M_ts->M_scalar_p1 = scalar_p1_space_ptrtype(
new scalar_p1_space_type ( M_mesh.get(),
597 MESH_RENUMBER | MESH_CHECK,
598 typename scalar_p1_space_type::periodicity_type(),
599 func.worldsComm() ) );
600 M_scalar_p1 = M_ts->M_scalar_p1;
601 DVLOG(2) <<
"[TimeSet::setMesh] setMesh space scalar p1 created\n";
604 else if ( M_mesh.get() == M_ts->M_scalar_p1->mesh() )
606 M_scalar_p1 = M_ts->M_scalar_p1;
609 if ( M_mesh.get() != M_ts->M_scalar_p1->mesh() && !M_scalar_p1 )
611 M_scalar_p1 = scalar_p1_space_ptrtype(
new scalar_p1_space_type ( M_mesh.get(),
612 MESH_RENUMBER | MESH_CHECK,
613 typename scalar_p1_space_type::periodicity_type(),
614 func.worldsComm() ) );
615 DVLOG(2) <<
"[TimeSet::setMesh] setMesh space scalar p1 created\n";
618 M_nodal_scalar.insert( std::make_pair( __fname, M_scalar_p1->element( __n ) ) );
622 if ( func.worldComm().isActive() )
623 interpolate( M_scalar_p1, func, M_nodal_scalar[__fname] );
625 DVLOG(2) <<
"[timset::add] scalar time : " << t.elapsed() <<
"\n";
628 else if ( FunctionType::is_vectorial )
632 if ( !M_ts->M_vector_p1 )
634 M_ts->M_vector_p1 = vector_p1_space_ptrtype(
new vector_p1_space_type ( M_mesh.get(),
635 MESH_RENUMBER | MESH_CHECK,
636 typename vector_p1_space_type::periodicity_type(),
637 func.worldsComm() ) );
638 M_vector_p1 = M_ts->M_vector_p1;
639 DVLOG(2) <<
"[TimeSet::setMesh] setMesh space scalar p1 created\n";
642 else if ( M_mesh.get() == M_ts->M_vector_p1->mesh() )
644 M_vector_p1 = M_ts->M_vector_p1;
647 if ( M_mesh.get() != M_ts->M_vector_p1->mesh() && !M_vector_p1 )
649 M_vector_p1 = vector_p1_space_ptrtype(
new vector_p1_space_type ( M_mesh.get(),
650 MESH_RENUMBER | MESH_CHECK,
651 typename vector_p1_space_type::periodicity_type(),
652 func.worldsComm() ) );
653 DVLOG(2) <<
"[timeset::add] setmesh : " << t.elapsed() <<
"\n";
654 DVLOG(2) <<
"[TimeSet::setMesh] setMesh space vector p1 created\n";
658 M_nodal_vector.insert( std::make_pair( __fname,M_vector_p1->element( __n ) ) );
661 DVLOG(2) <<
"[timeset::add] setmesh : " << t.elapsed() <<
"\n";
664 if ( func.worldComm().isActive() )
665 interpolate( M_vector_p1, func, M_nodal_vector[__fname] );
667 DVLOG(2) <<
"[timset::add] scalar time : " << t.elapsed() <<
"\n";
670 M_state.set( STEP_HAS_DATA|STEP_IN_MEMORY );
671 M_state.clear( STEP_ON_DISK );
673 showMe(
"Step::add" );
676 template<
typename FunctionType>
677 void add( std::string
const& __n, std::string
const& __fname, FunctionType
const& func, mpl::bool_<false>, mpl::bool_<false> )
679 if ( !func.worldComm().isActive() )
return;
681 if ( FunctionType::is_scalar )
683 if ( !M_ts->M_scalar_p0 )
685 M_ts->M_scalar_p0 = scalar_p0_space_ptrtype(
new scalar_p0_space_type ( M_mesh.get(),
686 MESH_RENUMBER | MESH_CHECK,
687 typename scalar_p0_space_type::periodicity_type(),
688 func.worldsComm() ) );
689 M_scalar_p0 = M_ts->M_scalar_p0;
690 DVLOG(2) <<
"[TimeSet::setMesh] setMesh space scalar p0 created\n";
693 else if ( M_mesh.get() == M_ts->M_scalar_p0->mesh() )
695 M_scalar_p0 = M_ts->M_scalar_p0;
698 if ( M_mesh.get() != M_ts->M_scalar_p0->mesh() && !M_scalar_p0 )
700 M_scalar_p0 = scalar_p0_space_ptrtype(
new scalar_p0_space_type ( M_mesh.get(),
701 MESH_RENUMBER | MESH_CHECK,
702 typename scalar_p0_space_type::periodicity_type(),
703 func.worldsComm() ) );
704 DVLOG(2) <<
"[TimeSet::setMesh] setMesh space scalar p0 created\n";
707 M_element_scalar.insert( std::make_pair( __fname,M_scalar_p0->element( __n ) ) );
711 if ( func.worldComm().isActive() )
712 interpolate( M_scalar_p0, func, M_element_scalar[__fname] );
715 DVLOG(2) <<
"[TimeSet::add] scalar p0 function " << __n <<
" added to exporter with filename " << __fname <<
"\n";
718 else if ( FunctionType::is_vectorial )
720 if ( !M_ts->M_vector_p0 )
722 M_ts->M_vector_p0 = vector_p0_space_ptrtype(
new vector_p0_space_type ( M_mesh.get(),
723 MESH_RENUMBER | MESH_CHECK,
724 typename vector_p0_space_type::periodicity_type(),
725 func.worldsComm() ) );
726 M_vector_p0 = M_ts->M_vector_p0;
727 DVLOG(2) <<
"[TimeSet::setMesh] setMesh space vector p0 created\n";
730 else if ( M_mesh.get() == M_ts->M_vector_p0->mesh() )
732 M_vector_p0 = M_ts->M_vector_p0;
735 if ( M_mesh.get() != M_ts->M_vector_p0->mesh() && !M_vector_p0 )
737 M_vector_p0 = vector_p0_space_ptrtype(
new vector_p0_space_type ( M_mesh.get(),
738 MESH_RENUMBER | MESH_CHECK,
739 typename vector_p0_space_type::periodicity_type(),
740 func.worldsComm() ) );
741 DVLOG(2) <<
"[TimeSet::setMesh] setMesh space vector p0 created\n";
745 M_element_vector.insert( std::make_pair( __fname,M_vector_p0->element( __n ) ) );
749 if ( func.worldComm().isActive() )
750 interpolate( M_vector_p0, func, M_element_vector[__fname] );
755 else if ( FunctionType::is_tensor2 )
757 M_element_tensor2[__fname].setName( __n );
758 M_element_tensor2[__fname].setFunctionSpace( M_tensor2_p0 );
760 if ( func.worldComm().isActive() )
761 interpolate( M_tensor2_p0, func, M_element_tensor2[__fname] );
766 M_state.set( STEP_HAS_DATA|STEP_IN_MEMORY );
767 M_state.clear( STEP_ON_DISK );
768 showMe(
"Step::addElement" );
769 DVLOG(2) <<
"[TimeSet::add] p0 function done\n";
778 nodal_scalar_const_iterator beginNodalScalar()
const
780 return M_nodal_scalar.begin();
782 nodal_scalar_const_iterator endNodalScalar()
const
784 return M_nodal_scalar.end();
786 nodal_vector_const_iterator beginNodalVector()
const
788 return M_nodal_vector.begin();
790 nodal_vector_const_iterator endNodalVector()
const
792 return M_nodal_vector.end();
794 nodal_tensor2_const_iterator beginNodalTensor2()
const
796 return M_nodal_tensor2.begin();
798 nodal_tensor2_const_iterator endNodalTensor2()
const
800 return M_nodal_tensor2.end();
803 element_scalar_const_iterator beginElementScalar()
const
805 return M_element_scalar.begin();
807 element_scalar_const_iterator endElementScalar()
const
809 return M_element_scalar.end();
811 element_vector_const_iterator beginElementVector()
const
813 return M_element_vector.begin();
815 element_vector_const_iterator endElementVector()
const
817 return M_element_vector.end();
819 element_tensor2_const_iterator beginElementTensor2()
const
821 return M_element_tensor2.begin();
823 element_tensor2_const_iterator endElementTensor2()
const
825 return M_element_tensor2.end();
828 bool operator==( Step
const& __s )
const
830 return this->
index() == __s.index();
832 bool operator<( Step
const& __s )
const
834 return this->
index() < __s.index();
839 this->setState( STEP_IN_MEMORY );
841 void showMe( std::string str )
const
843 DVLOG(2) << str <<
" index : " << M_index <<
"\n";
844 DVLOG(2) << str <<
" time : " << M_time <<
"\n";
845 DVLOG(2) << str <<
" isNew() " <<
isNew() <<
"\n";
846 DVLOG(2) << str <<
" hasData() " <<
hasData() <<
"\n";
847 DVLOG(2) << str <<
" isOnDisk() " <<
isOnDisk() <<
"\n";
848 DVLOG(2) << str <<
" isInMemory() " <<
isInMemory() <<
"\n";
894 friend class boost::serialization::access;
896 template<
class Archive>
897 void save( Archive & ar,
const unsigned int )
const
903 ar & boost::serialization::make_nvp(
"map_scalar_size", s );
905 scalar_const_iterator __its= M_scalar.begin();
906 scalar_const_iterator __ens= M_scalar.end();
908 for ( ; __its!= __ens; ++__its )
910 ar & boost::serialization::make_nvp(
"scalar", *__its );
913 s = M_complex.size();
914 ar & boost::serialization::make_nvp(
"map_complex_size", s );
916 complex_const_iterator __itc = M_complex.begin();
917 complex_const_iterator __enc = M_complex.end();
919 for ( ; __itc!= __enc; ++__itc )
921 ar & boost::serialization::make_nvp(
"complex", ( std::string
const& )__itc->first );
922 ar & boost::serialization::make_nvp(
"real", ( scalar_type
const& )__itc->second.first.real() );
923 ar & boost::serialization::make_nvp(
"imaginary", ( scalar_type
const& )__itc->second.first.imag() );
926 s = M_nodal_scalar.size();
927 ar & boost::serialization::make_nvp(
"map_nodal_scalar_size", s );
928 DVLOG(2) <<
"(saving) serialized size of nodal scalar (" << s <<
")\n";
929 nodal_scalar_const_iterator __itscalar = M_nodal_scalar.begin();
930 nodal_scalar_const_iterator __enscalar = M_nodal_scalar.end();
932 for ( ; __itscalar != __enscalar; ++__itscalar )
934 ar & ( nodal_scalar_type
const& ) __itscalar->second;
937 s = M_nodal_vector.size();
938 ar & boost::serialization::make_nvp(
"map_nodal_vector_size", s );
940 nodal_vector_const_iterator __itvector= M_nodal_vector.begin();
941 nodal_vector_const_iterator __envector= M_nodal_vector.end();
943 for ( ; __itvector!= __envector; ++__itvector )
945 ar & ( nodal_vector_type
const& ) __itvector->second;
948 s = M_nodal_tensor2.size();
949 ar & boost::serialization::make_nvp(
"map_nodal_tensor2_size", s );
951 nodal_tensor2_const_iterator __ittensor2= M_nodal_tensor2.begin();
952 nodal_tensor2_const_iterator __entensor2= M_nodal_tensor2.end();
954 for ( ; __ittensor2!= __entensor2; ++__ittensor2 )
956 ar & ( nodal_tensor2_type
const& ) __ittensor2->second;
959 s = M_element_scalar.size();
960 ar & boost::serialization::make_nvp(
"map_element_scalar_size", s );
961 DVLOG(2) <<
"(saving) serialized size of element scalar (" << s <<
")\n";
962 element_scalar_const_iterator __eitscalar = M_element_scalar.begin();
963 element_scalar_const_iterator __eenscalar = M_element_scalar.end();
965 for ( ; __eitscalar != __eenscalar; ++__eitscalar )
967 ar & ( element_scalar_type
const& ) __eitscalar->second;
970 s = M_element_vector.size();
971 ar & boost::serialization::make_nvp(
"map_element_vector_size", s );
973 element_vector_const_iterator __eitvector= M_element_vector.begin();
974 element_vector_const_iterator __eenvector= M_element_vector.end();
976 for ( ; __eitvector!= __eenvector; ++__eitvector )
978 ar & ( element_vector_type
const& ) __eitvector->second;
981 s = M_element_tensor2.size();
982 ar & boost::serialization::make_nvp(
"map_element_tensor2_size", s );
984 element_tensor2_const_iterator __eittensor2= M_element_tensor2.begin();
985 element_tensor2_const_iterator __eentensor2= M_element_tensor2.end();
987 for ( ; __eittensor2!= __eentensor2; ++__eittensor2 )
989 ar & ( element_tensor2_type
const& ) __eittensor2->second;
993 template<
class Archive>
994 void load( Archive & ar,
const unsigned int )
1000 ar & boost::serialization::make_nvp(
"map_scalar_size", s );
1001 DVLOG(2) <<
"(loading) serialized size of scalar (" << s <<
")\n";
1003 for (
size_type __i = 0; __i < s; ++__i )
1005 std::pair<std::string, std::pair<scalar_type,bool> > v;
1008 DVLOG(2) <<
"(loading) dserialized scalar " << v.first
1009 <<
" with value " << v.second.first <<
"\n";
1011 std::pair<scalar_iterator,bool> __it = M_scalar.insert( v );
1014 DVLOG(2) << v.first <<
" loaded and inserted (value: " << v.second.first <<
")\n";
1017 DVLOG(2) << v.first <<
" was loaded but not inserted (value: " << v.second.first <<
")\n";
1020 ar & boost::serialization::make_nvp(
"map_complex_size", s );
1021 DVLOG(2) <<
"(loading) serialized size of complex (" << s <<
")\n";
1023 for (
size_type __i = 0; __i < s; ++__i )
1025 std::pair<std::string, std::pair<complex_type,bool> > v;
1029 ar & boost::serialization::make_nvp(
"complex", v.first );
1030 ar & boost::serialization::make_nvp(
"real", v_real );
1031 ar & boost::serialization::make_nvp(
"imaginary", v_imag );
1033 v.second.first = complex_type( v_real, v_imag );
1038 std::pair<complex_iterator,bool> __it = M_complex.insert( v );
1041 DVLOG(2) << v.first <<
" loaded and inserted\n";
1044 DVLOG(2) << v.first <<
" was loaded but not inserted\n";
1049 ar & boost::serialization::make_nvp(
"map_nodal_scalar_size", s );
1050 DVLOG(2) <<
"(loading) serialized size of nodal scalar (" << s <<
")\n";
1052 for (
size_type __i = 0; __i < s; ++__i )
1054 nodal_scalar_type v;
1057 DVLOG(2) <<
"(loading) dserialized scalar field " << v.name()
1058 <<
" of size " << v.size() <<
"\n";
1060 std::pair<nodal_scalar_iterator,bool> __it = M_nodal_scalar.insert( std::make_pair( v.name(), v ) );
1063 DVLOG(2) << v.name() <<
" loaded and inserted (size: " << v.size() <<
")\n";
1066 DVLOG(2) << v.name() <<
" was loaded but not inserted (size: " << v.size() <<
")\n";
1070 ar & boost::serialization::make_nvp(
"map_nodal_vector_size", s );
1071 DVLOG(2) <<
"(loading) serialized size of nodal scalar (" << s <<
")\n";
1073 for (
size_type __i = 0; __i < s; ++__i )
1075 nodal_vector_type v;
1078 DVLOG(2) <<
"(loading) dserialized scalar field " << v.name()
1079 <<
" of size " << v.size() <<
"\n";
1081 std::pair<nodal_vector_iterator,bool> __it = M_nodal_vector.insert( std::make_pair( v.name(), v ) );
1084 DVLOG(2) << v.name() <<
" loaded and inserted (size: " << v.size() <<
")\n";
1087 DVLOG(2) << v.name() <<
" was loaded but not inserted (size: " << v.size() <<
")\n";
1091 ar & boost::serialization::make_nvp(
"map_nodal_tensor2_size", s );
1092 DVLOG(2) <<
"(loading) serialized size of nodal scalar (" << s <<
")\n";
1094 for (
size_type __i = 0; __i < s; ++__i )
1096 nodal_tensor2_type v;
1099 DVLOG(2) <<
"(loading) dserialized scalar field " << v.name()
1100 <<
" of size " << v.size() <<
"\n";
1102 std::pair<nodal_tensor2_iterator,bool> __it = M_nodal_tensor2.insert( std::make_pair( v.name(), v ) );
1105 DVLOG(2) << v.name() <<
" loaded and inserted (size: " << v.size() <<
")\n";
1108 DVLOG(2) << v.name() <<
" was loaded but not inserted (size: " << v.size() <<
")\n";
1113 ar & boost::serialization::make_nvp(
"map_element_scalar_size", s );
1114 DVLOG(2) <<
"(loading) serialized size of element scalar (" << s <<
")\n";
1116 for (
size_type __i = 0; __i < s; ++__i )
1118 element_scalar_type v;
1121 DVLOG(2) <<
"(loading) dserialized scalar field " << v.name()
1122 <<
" of size " << v.size() <<
"\n";
1124 std::pair<element_scalar_iterator,bool> __it = M_element_scalar.insert( std::make_pair( v.name(), v ) );
1127 DVLOG(2) << v.name() <<
" loaded and inserted (size: " << v.size() <<
")\n";
1130 DVLOG(2) << v.name() <<
" was loaded but not inserted (size: " << v.size() <<
")\n";
1134 ar & boost::serialization::make_nvp(
"map_element_vector_size", s );
1135 DVLOG(2) <<
"(loading) serialized size of element scalar (" << s <<
")\n";
1137 for (
size_type __i = 0; __i < s; ++__i )
1139 element_vector_type v;
1142 DVLOG(2) <<
"(loading) dserialized scalar field " << v.name()
1143 <<
" of size " << v.size() <<
"\n";
1145 std::pair<element_vector_iterator,bool> __it = M_element_vector.insert( std::make_pair( v.name(), v ) );
1148 DVLOG(2) << v.name() <<
" loaded and inserted (size: " << v.size() <<
")\n";
1151 DVLOG(2) << v.name() <<
" was loaded but not inserted (size: " << v.size() <<
")\n";
1155 ar & boost::serialization::make_nvp(
"map_element_tensor2_size", s );
1156 DVLOG(2) <<
"(loading) serialized size of element scalar (" << s <<
")\n";
1158 for (
size_type __i = 0; __i < s; ++__i )
1160 element_tensor2_type v;
1163 DVLOG(2) <<
"(loading) dserialized scalar field " << v.name()
1164 <<
" of size " << v.size() <<
"\n";
1166 std::pair<element_tensor2_iterator,bool> __it = M_element_tensor2.insert( std::make_pair( v.name(), v ) );
1169 DVLOG(2) << v.name() <<
" loaded and inserted (size: " << v.size() <<
")\n";
1172 DVLOG(2) << v.name() <<
" was loaded but not inserted (size: " << v.size() <<
")\n";
1176 template<
class Archive>
1177 void serialize( Archive & ar,
const unsigned int file_version )
1179 boost::serialization::split_member( ar, *
this, file_version );
1202 boost::optional<mesh_ptrtype> M_mesh;
1204 map_scalar_type M_scalar;
1205 map_complex_type M_complex;
1206 map_nodal_scalar_type M_nodal_scalar;
1207 map_nodal_vector_type M_nodal_vector;
1208 map_nodal_tensor2_type M_nodal_tensor2;
1209 map_element_scalar_type M_element_scalar;
1210 map_element_vector_type M_element_vector;
1211 map_element_tensor2_type M_element_tensor2;
1216 scalar_p0_space_ptrtype M_scalar_p0;
1217 vector_p0_space_ptrtype M_vector_p0;
1218 tensor2_p0_space_ptrtype M_tensor2_p0;
1219 scalar_p1_space_ptrtype M_scalar_p1;
1220 vector_p1_space_ptrtype M_vector_p1;
1221 tensor2_p1_space_ptrtype M_tensor2_p1;
1228 bool operator()( boost::shared_ptr<Step>
const& s1,
1229 boost::shared_ptr<Step>
const& s2 )
const
1239 typedef Step step_type;
1240 typedef boost::shared_ptr<Step> step_ptrtype;
1241 typedef std::set<step_ptrtype,ltstep> step_set_type;
1242 typedef typename step_set_type::iterator step_iterator;
1243 typedef typename step_set_type::const_iterator step_const_iterator;
1244 typedef typename step_set_type::reverse_iterator step_reverse_iterator;
1245 typedef typename step_set_type::const_reverse_iterator step_const_reverse_iterator;
1263 TimeSet( std::string filename =
"undefined",
bool init =
false );
1370 void setNumberOfStepsInMemory( uint16_type __i )
1386 step_ptrtype
step( Real __time,
bool __ignoreStep=
false )
1389 return step< mpl::bool_<true> >( __time );
1392 return step< mpl::bool_<false> >( __time );
1395 template <
typename IgnoreStepType>
1396 step_ptrtype
step( Real __time );
1399 step_iterator beginStep()
1403 step_const_iterator beginStep()
const
1408 step_reverse_iterator rbeginStep()
1412 step_const_reverse_iterator rbeginStep()
const
1417 step_iterator endStep()
1421 step_const_iterator endStep()
const
1426 step_reverse_iterator rendStep()
1430 step_const_reverse_iterator rendStep()
const
1436 step_iterator beginStep( mpl::bool_<false> )
1440 step_const_iterator beginStep( mpl::bool_<false> )
const
1444 step_iterator endStep( mpl::bool_<false> )
1448 step_const_iterator endStep( mpl::bool_<false> )
const
1453 step_iterator beginStep( mpl::bool_<true> )
1457 step_const_iterator beginStep( mpl::bool_<true> )
const
1461 step_iterator endStep( mpl::bool_<true> )
1465 step_const_iterator endStep( mpl::bool_<true> )
const
1470 std::pair<step_iterator,bool> insertStep( step_ptrtype __step, mpl::bool_<false> )
1474 std::pair<step_iterator,bool> insertStep( step_ptrtype __step, mpl::bool_<true> )
1485 void load( std::string _nameFile, Real __time )
1487 fs::ifstream ifs( _nameFile );
1489 boost::archive::text_iarchive ia( ifs );
1492 resetPreviousTime( __time );
1495 void save( std::string _nameFile )
1497 setNumberOfStepsInMemory( 0 );
1499 setNumberOfStepsInMemory( 1 );
1501 fs::ofstream ofs( _nameFile );
1503 boost::archive::text_oarchive oa( ofs );
1537 uint16_type M_keep_steps;
1540 friend class boost::serialization::access;
1542 template<
class Archive>
1543 void serialize( Archive & ar,
const unsigned int )
1545 ar & boost::serialization::make_nvp(
"name",
M_name );
1546 ar & boost::serialization::make_nvp(
"index",
M_index );
1548 ar & boost::serialization::make_nvp(
"keep_steps", M_keep_steps );
1550 if ( Archive::is_saving::value )
1553 ar & boost::serialization::make_nvp(
"number_of_steps", s );
1555 ar & boost::serialization::make_nvp(
"number_of_steps_ignored", s2 );
1560 for ( ; __it != __en; ++__it )
1562 if ( !( *__it )->isOnDisk() )
1564 DVLOG(2) <<
"not including step " << ( *__it )->index()
1565 <<
" at time " << ( *__it )->time() <<
"\n";
1566 ( *__it )->showMe(
"TimeSet::serialize" );
1570 double t = ( *__it )->time();
1571 ar & boost::serialization::make_nvp(
"time", t );
1573 ar & boost::serialization::make_nvp(
"index", ind );
1575 ar & boost::serialization::make_nvp(
"state", state );
1581 for ( ; __it != __en; ++__it )
1583 if ( !( *__it )->isOnDisk() )
1585 DVLOG(2) <<
"not including step " << ( *__it )->index()
1586 <<
" at time " << ( *__it )->time() <<
"\n";
1587 ( *__it )->showMe(
"TimeSet::serialize" );
1591 double t = ( *__it )->time();
1592 ar & boost::serialization::make_nvp(
"time_ignored", t );
1594 ar & boost::serialization::make_nvp(
"index_ignored", ind );
1596 ar & boost::serialization::make_nvp(
"state_ignored", state );
1600 if ( Archive::is_loading::value )
1603 ar & boost::serialization::make_nvp(
"number_of_steps", s );
1605 ar & boost::serialization::make_nvp(
"number_of_steps_ignored", s2 );
1607 for (
size_type __i = 0; __i < s; ++__i )
1610 ar & boost::serialization::make_nvp(
"time", t );
1613 ar & boost::serialization::make_nvp(
"index", ind );
1616 ar & boost::serialization::make_nvp(
"state", __state );
1618 step_iterator __sit;
1620 boost::tie( __sit, __inserted ) =
M_step_set.insert( step_ptrtype(
new Step(
this, t,ind, __state ) ) );
1622 FEELPP_ASSERT( __inserted )( t )( ind ).error (
"insertion failed" );
1625 for (
size_type __i = 0; __i < s2; ++__i )
1628 ar & boost::serialization::make_nvp(
"time_ignored", t );
1631 ar & boost::serialization::make_nvp(
"index_ignored", ind );
1634 ar & boost::serialization::make_nvp(
"state_ignored", __state );
1636 step_iterator __sit;
1638 boost::tie( __sit, __inserted ) =
M_stepIgnored_set.insert( step_ptrtype(
new Step(
this, t,ind, __state ) ) );
1640 FEELPP_ASSERT( __inserted )( t )( ind ).error (
"insertion failed" );
1650 void resetPreviousTime( Real __time );
1653 void setMesh( mesh_ptrtype m ) { M_mesh = m; }
1654 bool hasMesh()
const {
return M_mesh; }
1655 mesh_ptrtype mesh()
const
1657 DLOG_IF( WARNING, hasMesh() ) <<
"Time Set has no mesh data structure associated\n";
1658 return M_mesh.get();
1663 boost::optional<mesh_ptrtype> M_mesh;
1666 scalar_p0_space_ptrtype M_scalar_p0;
1667 vector_p0_space_ptrtype M_vector_p0;
1668 tensor2_p0_space_ptrtype M_tensor2_p0;
1669 scalar_p1_space_ptrtype M_scalar_p1;
1670 vector_p1_space_ptrtype M_vector_p1;
1671 tensor2_p1_space_ptrtype M_tensor2_p1;
1677 static uint32_type _S_current_index;
1681 template<
typename MeshType,
int N>
1682 inline FEELPP_EXPORT bool operator<( TimeSet<MeshType, N>
const& __ts1, TimeSet<MeshType, N>
const& __ts2 )
1684 return __ts1.index() < __ts2.index();
1687 template<
typename MeshType,
int N>
1688 inline FEELPP_EXPORT bool operator<( boost::shared_ptr<TimeSet<MeshType, N> >
const& __ts1,
1689 boost::shared_ptr<TimeSet<MeshType, N> >
const& __ts2 )
1691 return __ts1->index() < __ts2->index();
1694 template<
typename MeshType,
int N>
1695 FEELPP_NO_EXPORT bool operator<( typename TimeSet<MeshType, N>::step_type
const& __s1,
1696 typename TimeSet<MeshType, N>::step_type
const& __s2 )
1699 return __s1->time() < __s2->time();
1702 template<
typename MeshType,
int N>
1703 FEELPP_NO_EXPORT bool operator<( typename TimeSet<MeshType, N>::step_ptrtype
const& __s1,
1704 typename TimeSet<MeshType, N>::step_ptrtype
const& __s2 )
1706 return __s1->index() < __s2->index();
1709 template<
typename MeshType,
int N>
1713 M_index( _S_current_index++ ),
1714 M_time_increment( 0.1 ),
1717 std::ostringstream __str;
1718 __str <<
M_name <<
".ts";
1720 if ( fs::exists( __str.str() ) && !init )
1723 std::ifstream ifs( __str.str().c_str() );
1724 boost::archive::binary_iarchive ia( ifs );
1732 else if ( fs::exists( __str.str() ) )
1733 fs::remove( __str.str() );
1736 template<
typename MeshType,
int N>
1739 M_name( __ts.M_name ),
1740 M_index( __ts.M_index ),
1741 M_time_increment( __ts.M_time_increment ),
1742 M_keep_steps( __ts.M_keep_steps )
1746 template<
typename MeshType,
int N>
1747 TimeSet<MeshType, N>::~TimeSet()
1750 step_iterator __it = M_step_set.begin();
1751 step_iterator __en = M_step_set.end();
1753 for ( ; __it != __en; ++__it )
1755 ( *__it )->setState( STEP_ON_DISK );
1761 std::ostringstream __str;
1762 __str << M_name <<
".ts";
1764 std::ofstream ofs( __str.str().c_str() );
1768 boost::archive::binary_oarchive oa( ofs );
1770 oa << const_cast<TimeSet<MeshType, N>
const&>( *this );
1782 template<
typename MeshType,
int N>
1783 TimeSet<MeshType, N>&
1786 if (
this != &__ts )
1788 M_name = __ts.M_name;
1789 M_index = __ts.M_index;
1790 M_time_increment = __ts.M_time_increment;
1796 template<
typename MeshType,
int N>
1798 TimeSet<MeshType, N>::cleanup()
1800 step_iterator __it = M_step_set.begin();
1801 step_iterator __en = M_step_set.end();
1803 for ( ; __it != __en; ++__it )
1805 if ( ( *__it )->index() <= M_step_set.size() - M_keep_steps )
1806 ( *__it )->setState( STEP_ON_DISK );
1809 __it = M_stepIgnored_set.begin();
1810 __en = M_stepIgnored_set.end();
1812 for ( ; __it != __en; ++__it )
1814 if ( ( *__it )->index() <= M_stepIgnored_set.size() - M_keep_steps )
1815 ( *__it )->setState( STEP_ON_DISK );
1820 std::ostringstream __str;
1821 __str << M_name <<
".ts";
1823 std::ofstream ofs( __str.str().c_str() );
1827 boost::archive::binary_oarchive oa( ofs );
1829 oa << const_cast<TimeSet<MeshType, N>
const&>( *this );
1837 template<
typename MeshType,
int N>
1839 TimeSet<MeshType, N>::resetPreviousTime( Real __time )
1841 step_iterator __it = M_step_set.begin();
1842 step_iterator __en = M_step_set.end();
1845 while ( !find && __it != __en )
1847 if ( !( *__it )->isOnDisk() )
1849 DVLOG(2) <<
"not including step " << ( *__it )->index()
1850 <<
" at time " << ( *__it )->time() <<
"\n";
1851 ( *__it )->showMe(
"TimeSet::resetPreviousTime" );
1857 double t = ( *__it )->time();
1860 if ( ( t-eps ) <= __time ) ++__it;
1866 if ( find ) M_step_set.erase( __it,__en );
1868 __it = M_stepIgnored_set.begin();
1869 __en = M_stepIgnored_set.end();
1872 while ( !find && __it != __en )
1874 if ( !( *__it )->isOnDisk() )
1876 DVLOG(2) <<
"not including step " << ( *__it )->index()
1877 <<
" at time " << ( *__it )->time() <<
"\n";
1878 ( *__it )->showMe(
"TimeSet::resetPreviousTime" );
1884 double t = ( *__it )->time();
1887 if ( ( t-eps ) <= __time ) ++__it;
1893 if ( find ) M_stepIgnored_set.erase( __it,__en );
1898 template<
typename MeshType,
int N>
1899 template <
typename IgnoreStepType>
1900 typename TimeSet<MeshType, N>::step_ptrtype
1903 namespace lambda = boost::lambda;
1909 step_iterator __sit = beginStep( mpl::bool_<IgnoreStepType::value>() );
1911 for ( ; __sit != endStep( mpl::bool_<IgnoreStepType::value>() ); ++__sit )
1913 if ( math::abs( ( *__sit )->time() - __time ) < 1e-10 )
1917 if ( __sit == endStep( mpl::bool_<IgnoreStepType::value>() ) )
1921 DVLOG(2) <<
"[TimeSet<MeshType, N>::step] Inserting new step at time " << __time <<
" with index "
1922 << numberOfSteps( mpl::bool_<IgnoreStepType::value>() ) <<
"\n";
1924 step_ptrtype thestep(
new Step(
this, __time, numberOfSteps( mpl::bool_<IgnoreStepType::value>() ) + 1 ) );
1925 if ( this->hasMesh() )
1926 thestep->setMesh( this->mesh() );
1927 boost::tie( __sit, __inserted ) = insertStep( thestep,mpl::bool_<IgnoreStepType::value>() );
1932 DVLOG(2) <<
"[TimeSet<MeshType, N>::step] step was inserted properly? " << ( __inserted?
"yes":
"no" ) <<
"\n";
1933 DVLOG(2) <<
"[TimeSet<MeshType, N>::step] step index : " << ( *__sit )->index() <<
" time : " << ( *__sit )->time() <<
"\n";
1934 namespace lambda = boost::lambda;
1945 DVLOG(2) <<
"[TimeSet<MeshType, N>::step] found step at time " << __time <<
" with index "
1946 << ( *__sit )->index() <<
"\n";
1947 ( *__sit )->showMe(
"TimesSet::step(t)" );
1953 template<
typename MeshType,
int N>
1954 uint32_type TimeSet<MeshType, N>::_S_current_index = 1;
1960 template<
typename MeshType,
int N>
1961 TimeSet<MeshType, N>::Step::Step()
1965 M_state( STEP_NEW|STEP_OVERWRITE )
1969 template<
typename MeshType,
int N>
1970 TimeSet<MeshType, N>::Step::Step( TimeSet* ts, Real __t,
size_type __index,
size_type __state )
1977 showMe(
"Step::Step()" );
1980 template<
typename MeshType,
int N>
1981 TimeSet<MeshType, N>::Step::Step( Step
const& __step )
1983 M_time( __step.M_time ),
1984 M_index( __step.M_index ),
1985 M_state( __step.M_state )
1989 template<
typename MeshType,
int N>
1992 this->setState( STEP_ON_DISK );
1993 showMe(
"Step::~Step()" );
1996 template<
typename MeshType,
int N>
2001 DVLOG(2) <<
"executeState: isOnDisk() : " << __state.test( STEP_ON_DISK ) <<
"\n";
2002 DVLOG(2) <<
"executeState: isInMemory() : " << __state.test( STEP_IN_MEMORY ) <<
"\n";
2004 if ( hasData() && isInMemory() && __state.test( STEP_ON_DISK ) )
2007 DVLOG(2) <<
"saving step " << this->
index() <<
" at time " << this->time() <<
" on disk\n";
2008 std::ostringstream __str;
2009 __str <<
"step-" << this->
index();
2011 if ( !fs::exists( __str.str() ) || M_state.test( STEP_OVERWRITE ) )
2013 std::ofstream ofs( __str.str().c_str() );
2014 boost::archive::binary_oarchive oa( ofs );
2016 oa << const_cast<typename TimeSet<MeshType, N>::Step
const&>( *this );
2025 DVLOG(2) <<
"releasing step " <<
M_index <<
" at time " << M_time <<
" allocated memory for this step\n";
2028 nodal_scalar_iterator __itscalar = M_nodal_scalar.begin();
2029 nodal_scalar_iterator __enscalar = M_nodal_scalar.end();
2031 for ( ; __itscalar != __enscalar; ++__itscalar )
2033 __itscalar->second.clear();
2036 nodal_vector_iterator __itvector= M_nodal_vector.begin();
2037 nodal_vector_iterator __envector= M_nodal_vector.end();
2039 for ( ; __itvector!= __envector; ++__itvector )
2041 __itvector->second.clear();
2044 nodal_tensor2_iterator __ittensor2= M_nodal_tensor2.begin();
2045 nodal_tensor2_iterator __entensor2= M_nodal_tensor2.end();
2047 for ( ; __ittensor2!= __entensor2; ++__ittensor2 )
2049 __ittensor2->second.clear();
2053 element_scalar_iterator __itscalar = M_element_scalar.begin();
2054 element_scalar_iterator __enscalar = M_element_scalar.end();
2056 for ( ; __itscalar != __enscalar; ++__itscalar )
2058 __itscalar->second.clear();
2061 element_vector_iterator __itvector= M_element_vector.begin();
2062 element_vector_iterator __envector= M_element_vector.end();
2064 for ( ; __itvector!= __envector; ++__itvector )
2066 __itvector->second.clear();
2069 element_tensor2_iterator __ittensor2= M_element_tensor2.begin();
2070 element_tensor2_iterator __entensor2= M_element_tensor2.end();
2072 for ( ; __ittensor2!= __entensor2; ++__ittensor2 )
2074 __ittensor2->second.clear();
2077 M_state.clear( STEP_IN_MEMORY );
2080 M_state.set( STEP_ON_DISK );
2083 if ( hasData() && isOnDisk() && __state.test( STEP_IN_MEMORY ) )
2085 DVLOG(2) <<
"loading step " << this->
index() <<
" at time " << this->time() <<
" in memory\n";
2087 std::ostringstream __str;
2088 __str <<
"step-" << this->
index();
2090 if ( fs::exists( __str.str() ) )
2092 std::ifstream ifs( __str.str().c_str() );
2093 boost::archive::binary_iarchive ia( ifs );
2101 M_state.set( STEP_IN_MEMORY|STEP_HAS_DATA );
2102 M_state.clear( STEP_ON_DISK );