KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
serializer.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Pooyan Dadvand
11 //
12 //
13 
14 #pragma once
15 
16 // System includes
17 #include <map>
18 #include <set>
19 #include <string>
20 #include <cstring>
21 #include <sstream>
22 #include <fstream>
23 #include <iostream>
24 #include <unordered_map>
25 #include <unordered_set>
26 
27 // External includes
28 
29 // Project includes
30 #include "includes/define.h"
31 #include "input_output/logger.h"
32 #include "containers/flags.h"
33 #include "containers/array_1d.h"
35 
36 #define KRATOS_SERIALIZATION_DIRECT_LOAD(type) \
37  void load(std::string const & rTag, type& rValue) \
38  { \
39  load_trace_point(rTag); \
40  read(rValue); \
41  } \
42  void load(std::string const & rTag, type const& rValue) \
43  { \
44  load_trace_point(rTag); \
45  read(const_cast<type&>(rValue)); \
46  } \
47  \
48  void load_base(std::string const & rTag, type& rValue) \
49  { \
50  load_trace_point(rTag); \
51  read(rValue); \
52  }
53 
54 #define KRATOS_SERIALIZATION_DIRECT_SAVE(type) \
55  void save(std::string const & rTag, type const & rValue) \
56  { \
57  save_trace_point(rTag); \
58  write(rValue); \
59  } \
60  \
61  void save_base(std::string const & rTag, type const & rValue) \
62  { \
63  save_trace_point(rTag); \
64  write(rValue); \
65  }
66 
67 #define KRATOS_SERIALIZATION_DIRECT_CREATE(type) \
68  void* create(std::string const & rTag, type* prototype) \
69  { \
70  type* p_new = new type; \
71  load(rTag, *p_new); \
72  return p_new; \
73  }
74 
75 #define KRATOS_SERIALIZER_MODE_BINARY \
76  if(!mTrace) {
77 #define KRATOS_SERIALIZER_MODE_ASCII \
78  } else {
79 #define KRATOS_SERIALIZER_MODE_END \
80  }
81 namespace Kratos
82 {
83 
84 class ModelPart;
85 class VariableData;
86 template <class TDataType> class Variable;
87 // template <class TDataType> class KratosComponents;
88 
89 
92 
96 
100 
104 
108 
122 class KRATOS_API(KRATOS_CORE) Serializer
123 {
124 public:
127 
128  enum PointerType {SP_INVALID_POINTER, SP_BASE_CLASS_POINTER, SP_DERIVED_CLASS_POINTER};
129  enum TraceType {SERIALIZER_NO_TRACE=0, SERIALIZER_TRACE_ERROR=1, SERIALIZER_TRACE_ALL=2};
130 
134 
137 
139  KRATOS_DEFINE_LOCAL_FLAG( SHALLOW_GLOBAL_POINTERS_SERIALIZATION );
140 
141  typedef std::size_t SizeType;
142 
143  typedef void* (*ObjectFactoryType)();
144 
145  typedef std::map<void*, void*> LoadedPointersContainerType;
146 
147  typedef std::map<std::string, ObjectFactoryType> RegisteredObjectsContainerType;
148 
149  typedef std::map<std::string, std::string> RegisteredObjectsNameContainerType;
150 
151  typedef std::set<const void*> SavedPointersContainerType;
152 
153  typedef std::iostream BufferType;
154 
158 
160  explicit Serializer(BufferType* pBuffer, TraceType const& rTrace=SERIALIZER_NO_TRACE) :
161  mpBuffer(pBuffer), mTrace(rTrace), mNumberOfLines(0)
162  {
163  }
164 
166  virtual ~Serializer()
167  {
168  delete mpBuffer;
169  }
170 
174 
177  void SetLoadState();
178 
184  TraceType GetTraceType() const {return mTrace;}
185 
186  void SetBuffer(BufferType* pBuffer)
187  {
188  mpBuffer = pBuffer;
189  }
190 
191  template<class TDataType>
192  static void* Create()
193  {
194  return new TDataType;
195  }
196 
197  template<class TDataType>
198  static void Register(std::string const & rName, TDataType const& pPrototype)
199  {
200  msRegisteredObjects.insert(RegisteredObjectsContainerType::value_type(rName,Create<TDataType>));
201  msRegisteredObjectsName.insert(RegisteredObjectsNameContainerType::value_type(typeid(TDataType).name(), rName));
202  //std::cout<<" REGISTERED OBJECT "<<rName<<" TypeID "<<typeid (TDataType).name()<<std::endl;
203  //msRegisteredObjects.insert(RegisteredObjectsContainerType::value_type(rName,&pPrototype));
204  }
205 
206  template<class TDataType>
207  void load(std::string const & rTag, TDataType& rObject)
208  {
209  load_trace_point(rTag);
210  rObject.load(*this);
211  }
212 
213  template<class TDataType>
214  void load(std::string const & rTag, Kratos::shared_ptr<TDataType>& pValue)
215  {
216  PointerType pointer_type = SP_INVALID_POINTER;
217  void* p_pointer;
218  read(pointer_type);
219 
220  if(pointer_type != SP_INVALID_POINTER)
221  {
222  read(p_pointer);
223  LoadedPointersContainerType::iterator i_pointer = mLoadedPointers.find(p_pointer);
224  if(i_pointer == mLoadedPointers.end())
225  {
226  if(pointer_type == SP_BASE_CLASS_POINTER)
227  {
228  if(!pValue) {
229  pValue = Kratos::shared_ptr<TDataType>(new TDataType);
230  }
231  }
232  else if(pointer_type == SP_DERIVED_CLASS_POINTER)
233  {
234  std::string object_name;
235  read(object_name);
236  typename RegisteredObjectsContainerType::iterator i_prototype = msRegisteredObjects.find(object_name);
237 
238  KRATOS_ERROR_IF(i_prototype == msRegisteredObjects.end())
239  << "There is no object registered in Kratos with name : "
240  << object_name << std::endl;
241 
242  if(!pValue) {
243  pValue = Kratos::shared_ptr<TDataType>(static_cast<TDataType*>((i_prototype->second)()));
244  }
245  }
246 
247  // Load the pointer address before loading the content
248  mLoadedPointers[p_pointer]=&pValue;
249  load(rTag, *pValue);
250  }
251  else
252  {
253  pValue = *static_cast<Kratos::shared_ptr<TDataType>*>((i_pointer->second));
254  }
255  }
256  }
257 
258  template<class TDataType>
259  void load(std::string const & rTag, Kratos::intrusive_ptr<TDataType>& pValue)
260  {
261  PointerType pointer_type = SP_INVALID_POINTER;
262  void* p_pointer;
263  read(pointer_type);
264 
265  if(pointer_type != SP_INVALID_POINTER)
266  {
267  read(p_pointer);
268  LoadedPointersContainerType::iterator i_pointer = mLoadedPointers.find(p_pointer);
269  if(i_pointer == mLoadedPointers.end())
270  {
271  if(pointer_type == SP_BASE_CLASS_POINTER)
272  {
273  if(!pValue) {
274  pValue = Kratos::intrusive_ptr<TDataType>(new TDataType);
275  }
276  }
277  else if(pointer_type == SP_DERIVED_CLASS_POINTER)
278  {
279  std::string object_name;
280  read(object_name);
281  typename RegisteredObjectsContainerType::iterator i_prototype = msRegisteredObjects.find(object_name);
282 
283  KRATOS_ERROR_IF(i_prototype == msRegisteredObjects.end())
284  << "There is no object registered in Kratos with name : "
285  << object_name << std::endl;
286 
287  if(!pValue) {
288  pValue = Kratos::intrusive_ptr<TDataType>(static_cast<TDataType*>((i_prototype->second)()));
289  }
290  }
291 
292  // Load the pointer address before loading the content
293  mLoadedPointers[p_pointer]=&pValue;
294  load(rTag, *pValue);
295  }
296  else
297  {
298  pValue = *static_cast<Kratos::intrusive_ptr<TDataType>*>((i_pointer->second));
299  }
300  }
301  }
302 
303  template<class TDataType>
304  void load(std::string const & rTag, Kratos::unique_ptr<TDataType>& pValue)
305  {
306  PointerType pointer_type = SP_INVALID_POINTER;
307  void* p_pointer;
308  read(pointer_type);
309 
310  if(pointer_type != SP_INVALID_POINTER)
311  {
312  read(p_pointer);
313  LoadedPointersContainerType::iterator i_pointer = mLoadedPointers.find(p_pointer);
314  if(i_pointer == mLoadedPointers.end())
315  {
316  if(pointer_type == SP_BASE_CLASS_POINTER)
317  {
318  if(!pValue) {
319  pValue = Kratos::unique_ptr<TDataType>(new TDataType);
320  }
321  }
322  else if(pointer_type == SP_DERIVED_CLASS_POINTER)
323  {
324  std::string object_name;
325  read(object_name);
326  typename RegisteredObjectsContainerType::iterator i_prototype = msRegisteredObjects.find(object_name);
327 
328  KRATOS_ERROR_IF(i_prototype == msRegisteredObjects.end())
329  << "There is no object registered in Kratos with name : "
330  << object_name << std::endl;
331 
332  if(!pValue) {
333  pValue = std::move(Kratos::unique_ptr<TDataType>(static_cast<TDataType*>((i_prototype->second)())));
334  }
335  }
336 
337  // Load the pointer address before loading the content
338  mLoadedPointers[p_pointer]=pValue.get();
339  load(rTag, *pValue);
340  }
341  else
342  {
343  pValue = std::move(Kratos::unique_ptr<TDataType>(static_cast<TDataType*>((i_pointer->second))));
344  }
345  }
346  }
347 
348  template<class TDataType>
349  void load(std::string const & rTag, TDataType*& pValue)
350  {
351  PointerType pointer_type = SP_INVALID_POINTER;
352  void* p_pointer;
353  read(pointer_type);
354 
355  if(pointer_type != SP_INVALID_POINTER)
356  {
357  read(p_pointer);
358  LoadedPointersContainerType::iterator i_pointer = mLoadedPointers.find(p_pointer);
359  if(i_pointer == mLoadedPointers.end())
360  {
361  if(pointer_type == SP_BASE_CLASS_POINTER)
362  {
363  if(!pValue) {
364  pValue = new TDataType;
365  }
366  }
367  else if(pointer_type == SP_DERIVED_CLASS_POINTER)
368  {
369  std::string object_name;
370  read(object_name);
371  typename RegisteredObjectsContainerType::iterator i_prototype = msRegisteredObjects.find(object_name);
372 
373  KRATOS_ERROR_IF(i_prototype == msRegisteredObjects.end())
374  << "There is no object registered in Kratos with name : "
375  << object_name << std::endl;
376 
377  if(!pValue) {
378  pValue = static_cast<TDataType*>((i_prototype->second)());
379  }
380 
381  }
382 
383  // Load the pointer address before loading the content
384  mLoadedPointers[p_pointer]=&pValue;
385  load(rTag, *pValue);
386  }
387  else
388  {
389  pValue = *static_cast<TDataType**>((i_pointer->second));
390  }
391  }
392  }
393 
394  void load(std::string const & rTag, ModelPart*& pValue);
395 
396  void load(std::string const & rTag, Kratos::unique_ptr<ModelPart>& pValue);
397 
398  void load(std::string const & rTag, Kratos::shared_ptr<ModelPart>& pValue);
399 
400 
401  template<class TDataType>
402  void load(std::string const & rTag, Kratos::weak_ptr<TDataType>& pValue)
403  {
404  // This is for testing. I have to change it. Pooyan.
405  //KRATOS_ERROR << "The serialization for weak_ptrs is not implemented yet" << std::endl;
406 // read(*pValue);
407  }
408 
409  template<class TDataType>
410  void load(std::string const & rTag, WeakPointerVector<TDataType>& pValue)
411  {
412  // This is for testing. I have to change it. Pooyan.
413  //KRATOS_ERROR << "The serialization for weak_ptrs is not implemented yet" << std::endl;
414 // read(*pValue);
415  }
416 
417  template<class TDataType>
418  void load(std::string const & rTag, const Variable<TDataType>* /*pVariable*/)
419  {
420  load_trace_point(rTag);
421  std::string name;
422  read(name);
423  }
424 
425  template<class TDataType, std::size_t TDataSize>
426  void load(std::string const & rTag, std::array<TDataType, TDataSize>& rObject)
427  {
428  load_trace_point(rTag);
429  for (SizeType i = 0; i < TDataSize; i++)
430  load("E", rObject[i]);
431  }
432 
433  template<class TDataType>
434  void load(std::string const & rTag, std::vector<TDataType>& rObject)
435  {
436  load_trace_point(rTag);
437  SizeType size;
438 
439  load("size", size);
440 
441  rObject.resize(size);
442 
443  for(SizeType i = 0 ; i < size ; i++)
444  load("E", rObject[i]);
445 // read(rObject);
446  }
447 
448  template<class TDataType>
449  void load(std::string const & rTag, DenseVector<TDataType>& rObject)
450  {
451  load_trace_point(rTag);
452  SizeType size;
453 
454  load("size", size);
455 
456  rObject.resize(size,false);
457 
458  for(SizeType i = 0 ; i < size ; i++)
459  load("E", rObject[i]);
460 // read(rObject);
461  }
462 
463 
464  template<class TKeyType, class TDataType>
465  void load(std::string const & rTag, std::map<TKeyType, TDataType>& rObject)
466  {
467  load_associative_container(rTag, rObject);
468  }
469 
470  template<class TKeyType, class TDataType>
471  void load(std::string const & rTag, std::unordered_map<TKeyType, TDataType>& rObject)
472  {
473  load_associative_container(rTag, rObject);
474  }
475 
476  template<class TDataType>
477  void load(std::string const & rTag, std::set<TDataType>& rObject)
478  {
479  load_associative_container(rTag, rObject);
480  }
481 
482  template<class TDataType>
483  void load(std::string const & rTag, std::unordered_set<TDataType>& rObject)
484  {
485  load_associative_container(rTag, rObject);
486  }
487 
488  template<class TDataType, std::size_t TDimension>
489  void load(std::string const & rTag, array_1d<TDataType, TDimension>& rObject)
490  {
491  load_trace_point(rTag);
492  //rObject = array_1d<TDataType, TDimension>(); //it generates a warnning --> commented 23/09/2015 <--
493  for(SizeType i = 0 ; i < TDimension ; i++)
494  load("E", rObject[i]);
495 // read(rObject);
496  }
497 
498  template<class TFirstType, class TSecondType>
499  void load(std::string const & rTag, std::pair<TFirstType, TSecondType>& rObject)
500  {
501  load_trace_point(rTag);
502  load("First", rObject.first);
503  load("Second", rObject.second);
504  }
505 
506  template<class TDataType, std::size_t TDimension>
507  void load(std::string const & rTag, BoundedVector<TDataType, TDimension>& rObject)
508  {
509  load_trace_point(rTag);
510 
511  for(SizeType i = 0 ; i < TDimension ; ++i)
512  load("E", rObject[i]);
513 // read(rObject);
514  }
515 
516  template<class TDataType, std::size_t TDimension1, std::size_t TDimension2>
517  void load(std::string const & rTag, BoundedMatrix<TDataType, TDimension1, TDimension2>& rObject)
518  {
519  load_trace_point(rTag);
520 
521  for(SizeType i = 0 ; i < TDimension1 ; ++i)
522  for(SizeType j = 0 ; j < TDimension2 ; ++j)
523  load("E", rObject(i,j));
524 // read(rObject);
525  }
526 
531  KRATOS_SERIALIZATION_DIRECT_LOAD(unsigned long)
536 //#ifdef _WIN32 // work around for windows int64_t error
537 // KRATOS_SERIALIZATION_DIRECT_LOAD(__int64)
538 //#endif
539 #ifdef _WIN64 // work around for windows size_t error in win64
541 #endif
542  KRATOS_SERIALIZATION_DIRECT_LOAD(std::complex<double>)
543 
544  template<class TDataType, std::size_t TDataSize>
545  void save(std::string const & rTag, std::array<TDataType, TDataSize> const& rObject)
546  {
547  save_trace_point(rTag);
548  for (SizeType i = 0; i < TDataSize; i++)
549  save("E", rObject[i]);
550  }
551 
552  template<class TDataType>
553  void save(std::string const & rTag, std::vector<TDataType> const& rObject)
554  {
555  save_trace_point(rTag);
556  SizeType size = rObject.size();
557 
558  save("size", size);
559 
560  // Workaround for the special case of std::vector<bool>.
561  // Long story short, the return type of std::vector<bool>::operator[]
562  // is not necessarily bool&, but up to the STL vendor's decision.
563  // Detailed explanation: https://github.com/KratosMultiphysics/Kratos/issues/10357#issuecomment-1274725614.
564  using SaveType = std::conditional_t<
566  bool,
567  const TDataType&
568  >;
569 
570  for(SizeType i = 0 ; i < size ; i++)
571  save("E", SaveType(rObject[i]));
572 // write(rObject);
573  }
574 
575  template<class TDataType>
576  void save(std::string const & rTag, DenseVector<TDataType> const& rObject)
577  {
578  save_trace_point(rTag);
579  SizeType size = rObject.size();
580 
581  save("size", size);
582 
583  for(SizeType i = 0 ; i < size ; i++)
584  save("E", rObject[i]);
585 // write(rObject);
586  }
587 
588  template<class TDataType, std::size_t TDimension>
589  void save(std::string const & rTag, array_1d<TDataType, TDimension> const& rObject)
590  {
591  save_trace_point(rTag);
592  for(SizeType i = 0 ; i < TDimension ; i++)
593  save("E", rObject[i]);
594 
595 // write(rObject);
596  }
597 
598  template<class TKeyType, class TDataType>
599  void save(std::string const & rTag, std::map<TKeyType, TDataType> const& rObject)
600  {
601  save_associative_container(rTag, rObject);
602  }
603 
604  template<class TKeyType, class TDataType>
605  void save(std::string const & rTag, std::unordered_map<TKeyType, TDataType> const& rObject)
606  {
607  save_associative_container(rTag, rObject);
608  }
609 
610  template<class TDataType>
611  void save(std::string const & rTag, std::set<TDataType> const& rObject)
612  {
613  save_associative_container(rTag, rObject);
614  }
615 
616  template<class TDataType>
617  void save(std::string const & rTag, std::unordered_set<TDataType> const& rObject)
618  {
619  save_associative_container(rTag, rObject);
620  }
621 
622  template<class TDataType>
623  void save(std::string const & rTag, TDataType const& rObject)
624  {
625  save_trace_point(rTag);
626  rObject.save(*this);
627  }
628 
629  template<class TDataType>
630  void save(std::string const & rTag, const Variable<TDataType>* pVariable)
631  {
632  save_trace_point(rTag);
633  write(pVariable->Name());
634  }
635 
636 
637  template<class TDataType>
638  void save(std::string const & rTag, Kratos::shared_ptr<TDataType> pValue)
639  {
640  save(rTag, pValue.get());
641  }
642 
643  template<class TDataType>
644  void save(std::string const & rTag, Kratos::intrusive_ptr<TDataType> pValue)
645  {
646  save(rTag, pValue.get());
647  }
648 
649 
650  template<class TDataType>
651  void save(std::string const & rTag, Kratos::unique_ptr<TDataType> const& pValue)
652  {
653  save(rTag, pValue.get());
654  }
655 
656  template<class TDataType>
657  void save(std::string const & rTag, const TDataType * pValue)
658  {
659  if(pValue)
660  {
661  if(IsDerived(pValue))
662  write(SP_DERIVED_CLASS_POINTER);
663  else
664  write(SP_BASE_CLASS_POINTER);
665 
666  SavePointer(rTag,pValue);
667  }
668  else
669  {
670  write(SP_INVALID_POINTER);
671  }
672  }
673 
674  template<class TDataType>
675  bool IsDerived(TDataType * pValue)
676  {
677  if (strcmp(typeid(TDataType).name(), typeid(*pValue).name()) != 0) {
678  return true;
679  }
680  else {
681  return false;
682  }
683  // bool is_derived = (typeid(TDataType) != typeid(*pValue));
684 // std::cout << "for TDataType : " << typeid(TDataType).name() << " and *pValue type : " << typeid(*pValue).name() << " is derived : " << is_derived << std::endl;
685  //return is_derived;
686  }
687 
688 
689  template<class TDataType>
690  void save(std::string const & rTag, TDataType * pValue)
691  {
692  if(pValue)
693  {
694  if(IsDerived(pValue))
695  {
696  write(SP_DERIVED_CLASS_POINTER);
697  }
698  else
699  {
700  write(SP_BASE_CLASS_POINTER);
701  }
702 
703  SavePointer(rTag,pValue);
704  }
705  else
706  {
707  write(SP_INVALID_POINTER);
708  }
709  }
710 
711  template<class TDataType>
712  void save(std::string const & rTag, Kratos::weak_ptr<TDataType> pValue)
713  {
714  // This is for testing. I have to implement it. Pooyan.
715  //KRATOS_ERROR << "The serialization for weak_ptrs is not implemented yet" << std::endl;
716 // write(*pValue);
717  }
718 
719  template<class TDataType>
720  void save(std::string const & rTag, Kratos::WeakPointerVector<TDataType> pValue)
721  {
722  // This is for testing. I have to implement it. Pooyan.
723  //KRATOS_ERROR << "The serialization for weak_ptrs is not implemented yet" << std::endl;
724 // write(*pValue);
725  }
726 
727  template<class TDataType>
728  void save(std::string const & rTag, Kratos::shared_ptr<const TDataType> pValue)
729  {
730  // This is for testing. I have to change it. Pooyan.
731 // save_trace_point(rTag);
732 // write(*pValue);
733  save(rTag, pValue.get());
734  }
735 
736  void save(std::string const & rTag, const char * pValue)
737  {
738  save_trace_point(rTag);
739  write(std::string(pValue));
740  }
741 
742 
743  template<class TFirstType, class TSecondType>
744  void save(std::string const & rTag, std::pair<TFirstType, TSecondType> rObject)
745  {
746  save_trace_point(rTag);
747  save("First", rObject.first);
748  save("Second", rObject.second);
749  }
750 
751  template<class TDataType, std::size_t TDimension>
752  void save(std::string const & rTag, BoundedVector<TDataType, TDimension> const& rObject)
753  {
754  save_trace_point(rTag);
755 
756  for(SizeType i = 0 ; i < TDimension ; ++i)
757  save("E", rObject[i]);
758 // write(rObject);
759  }
760 
761  template<class TDataType, std::size_t TDimension1, std::size_t TDimension2>
762  void save(std::string const & rTag, BoundedMatrix<TDataType, TDimension1, TDimension2> const& rObject)
763  {
764  save_trace_point(rTag);
765 
766  for(SizeType i = 0 ; i < TDimension1 ; ++i)
767  for(SizeType j = 0 ; j < TDimension2 ; ++j)
768  save("E", rObject(i,j));
769 // write(rObject);
770  }
771 
776  KRATOS_SERIALIZATION_DIRECT_SAVE(unsigned long)
781 //#ifdef _WIN32 // work around for windows int64_t error
782 // KRATOS_SERIALIZATION_DIRECT_SAVE(__int64)
783 //#endif
784 #ifdef _WIN64 // work around for windows size_t error in win64
786 #endif
787  KRATOS_SERIALIZATION_DIRECT_SAVE(std::complex<double>)
788 
789 
790  template<class TDataType>
791  void load_base(std::string const & rTag, TDataType& rObject)
792  {
793  load_trace_point(rTag);
794  rObject.TDataType::load(*this);
795  }
796 
797 
798  template<class TDataType>
799  void load_base(std::string const & rTag, std::vector<TDataType>& rObject)
800  {
801  load_trace_point(rTag);
802  load(rTag, rObject);
803  }
804 
805  template<class TDataType>
806  void load_base(std::string const & rTag, DenseVector<TDataType>& rObject)
807  {
808  load_trace_point(rTag);
809  load(rTag, rObject);
810  }
811 
812  template<class TDataType, std::size_t TDimension>
813  void load_base(std::string const & rTag, array_1d<TDataType, TDimension>& rObject)
814  {
815  load_trace_point(rTag);
816  load(rTag, rObject);
817  }
818 
819  template<class TDataType>
820  void save_base(std::string const & rTag, std::vector<TDataType> const& rObject)
821  {
822  save_trace_point(rTag);
823  save(rTag, rObject);
824  }
825 
826  template<class TDataType>
827  void save_base(std::string const & rTag, DenseVector<TDataType> const& rObject)
828  {
829  save_trace_point(rTag);
830  save(rTag, rObject);
831  }
832 
833  template<class TDataType, std::size_t TDimension>
834  void save_base(std::string const & rTag, array_1d<TDataType, TDimension> const& rObject)
835  {
836  save_trace_point(rTag);
837  save(rTag, rObject);
838  }
839 
840  template<class TDataType>
841  void save_base(std::string const & rTag, TDataType const& rObject)
842  {
843  save_trace_point(rTag);
844  rObject.TDataType::save(*this);
845  }
846 
847  void save_trace_point(std::string const & rTag)
848  {
849  if(mTrace)
850  {
851  write(rTag);
852  }
853  }
854 
855  bool load_trace_point(std::string const & rTag)
856  {
857  if(mTrace == SERIALIZER_TRACE_ERROR) // only reporting the errors
858  {
859  std::string read_tag;
860  read(read_tag);
861  if(read_tag == rTag)
862  return true;
863  else
864  {
865  std::stringstream buffer;
866  buffer << "In line " << mNumberOfLines;
867  buffer << " the trace tag is not the expected one:" << std::endl;
868  buffer << " Tag found : " << read_tag << std::endl;
869  buffer << " Tag given : " << rTag << std::endl;
870  KRATOS_ERROR << buffer.str() << std::endl;
871  }
872  }
873  else if(mTrace == SERIALIZER_TRACE_ALL) // also reporting matched tags.
874  {
875  std::string read_tag;
876  read(read_tag);
877  if(read_tag == rTag)
878  {
879  KRATOS_INFO("Serializer") << "In line " << mNumberOfLines << " loading " << rTag << " as expected" << std::endl;
880  return true;
881  }
882  else
883  {
884  std::stringstream buffer;
885  buffer << "In line " << mNumberOfLines;
886  buffer << " the trace tag is not the expected one:" << std::endl;
887  buffer << " Tag found : " << read_tag << std::endl;
888  buffer << " Tag given : " << rTag << std::endl;
889  KRATOS_ERROR << buffer.str() << std::endl;
890  }
891  }
892  return false;
893 
894  }
895 
896 
897 
898 
902 
904  {
905  return mpBuffer;
906  }
907 
913  template<class TDataType>
914  void AddToSavedPointers(const TDataType& pValue) {
915  mSavedPointers.insert(pValue);
916  }
917 
923  void RedirectLoadingPointer(void * pStoredPointer, void * pAllocatedPosition) {
924  mLoadedPointers[pStoredPointer]=pAllocatedPosition;
925  }
926 
928  {
929  return msRegisteredObjects;
930  }
931 
933  {
934  return msRegisteredObjectsName;
935  }
936 
937  void Set(const Flags ThisFlag)
938  {
939  mFlags.Set(ThisFlag);
940  }
941 
945 
946  bool Is(Flags const & rOtherFlag) const
947  {
948  return mFlags.Is(rOtherFlag);
949  }
950 
954 
956  virtual std::string Info() const
957  {
958  return "Serializer";
959  }
960 
962  virtual void PrintInfo(std::ostream& rOStream) const
963  {}
964 
966  virtual void PrintData(std::ostream& rOStream) const
967  {}
968 
969 
973 
974 
976 
977 protected:
980 
981 
985 
986 
990 
991 
995 
996 
1000 
1001 
1005 
1006 
1010 
1011 
1013 
1014 private:
1017 
1018  static RegisteredObjectsContainerType msRegisteredObjects;
1019  static RegisteredObjectsNameContainerType msRegisteredObjectsName;
1020 
1024 
1025  Flags mFlags;
1026 
1027  BufferType* mpBuffer;
1028  TraceType mTrace;
1029  SizeType mNumberOfLines;
1030 
1031  SavedPointersContainerType mSavedPointers;
1032  LoadedPointersContainerType mLoadedPointers;
1033 
1037 
1038 
1042 
1043 
1044  template<class TDataType>
1045  void SavePointer(std::string const & rTag, const TDataType * pValue)
1046  {
1047  write(pValue);
1048  if (mSavedPointers.find(pValue) == mSavedPointers.end())
1049  {
1050  mSavedPointers.insert(pValue);
1051  if (IsDerived(pValue))
1052  {
1053  typename RegisteredObjectsNameContainerType::iterator i_name = msRegisteredObjectsName.find(typeid (*pValue).name());
1054 
1055  if (i_name == msRegisteredObjectsName.end()) {
1056  KRATOS_ERROR << "There is no object registered in Kratos with type id : "
1057  << typeid (*pValue).name() << std::endl;
1058  } else {
1059  write(i_name->second);
1060  }
1061  }
1062 
1063  save(rTag, *pValue);
1064  }
1065  }
1066 
1067  VariableData* GetVariableData(std::string const & VariableName);
1068 
1069  template<class TMapType>
1070  void load_associative_container(std::string const & rTag, TMapType& rObject)
1071  {
1072  load_trace_point(rTag);
1073  SizeType size = rObject.size();
1074 
1075  load("size", size);
1076 
1077  for(SizeType i = 0 ; i < size ; i++){
1078  typename TMapType::value_type temp;
1079  load("E", temp);
1080  rObject.insert(temp);
1081  }
1082  }
1083 
1084 
1085  template<class TMapType>
1086  void save_associative_container(std::string const & rTag, TMapType const& rObject)
1087  {
1088  save_trace_point(rTag);
1089  SizeType size = rObject.size();
1090 
1091  save("size", size);
1092 
1093  for(auto& i : rObject)
1094  save("E", i);
1095  }
1096 
1097 
1098 
1099 // void read(bool& rData)
1100 // {
1101 // int temp;
1102 // read(temp);
1103 // rData = temp << 1;
1104 //
1105 // }
1106 //
1107 // void write(bool& rData)
1108 // {
1109 // int temp(rData);
1110 // write(temp);
1111 // }
1112 //
1113 // void read(std::string& rValue)
1114 // {
1115 // *mpBuffer >> rValue;
1116 // }
1117 //
1118 // void write(std::string& rValue)
1119 // {
1120 // *mpBuffer << rValue;
1121 // }
1122 
1123  void read(PointerType& rValue)
1124  {
1126 
1127  int temp;
1128  mpBuffer->read((char *)(&temp),sizeof(PointerType));
1129  rValue = PointerType(temp);
1130 
1132 
1133  int temp;
1134  *mpBuffer >> temp;
1135  rValue = PointerType(temp);
1136  mNumberOfLines++;
1137 
1139  }
1140 
1141  void write(PointerType const& rValue)
1142  {
1144 
1145  int ptr = (int)rValue;
1146  const char * data = reinterpret_cast<const char*>(&ptr);
1147  mpBuffer->write(data,sizeof(PointerType));
1148 
1150 
1151  *mpBuffer << int(rValue) << std::endl;
1152 
1154  }
1155 
1156  void read(std::string& rValue)
1157  {
1159 
1160  SizeType size;
1161  mpBuffer->read((char *)(&size),sizeof(SizeType));
1162  rValue.resize(size);
1163  if (size>0) {
1164  mpBuffer->read(rValue.data(), size);
1165  }
1166 
1168 
1169  // going to the first '"'
1170  std::getline( *mpBuffer,rValue, '\"');
1171  // reading the string itself until second '"'
1172  std::getline( *mpBuffer,rValue, '\"');
1173  mNumberOfLines++;
1174 
1176  }
1177 
1178  void write(std::string const& rValue)
1179  {
1181 
1182  const char * data = rValue.c_str();
1183  SizeType rData_size = rValue.length() * sizeof(char);
1184 
1185  const char * data1 = reinterpret_cast<const char *>(&rData_size);
1186 
1187  mpBuffer->write(data1,sizeof(SizeType));
1188  mpBuffer->write(data,rData_size);
1189 
1191 
1192  *mpBuffer << "\"" << rValue << "\"" << std::endl;
1193 
1195  }
1196 
1197  template<class TDataType>
1198  void read(TDataType& rData)
1199  {
1201 
1202  mpBuffer->read((char *)(&rData),sizeof(TDataType));
1203 
1205 
1206  *mpBuffer >> rData;
1207  mNumberOfLines++;
1208 
1210  }
1211 
1212  template<class TDataType>
1213  void write(TDataType const& rData)
1214  {
1216 
1217  const char * data = reinterpret_cast<const char*>(&rData);
1218  mpBuffer->write(data,sizeof(TDataType));
1219 
1221 
1222  *mpBuffer << rData << std::endl;
1223 
1225  }
1226 
1227  template<class TDataType>
1228  void read(std::vector<TDataType>& rData)
1229  {
1231 
1232  SizeType size;
1233  mpBuffer->read((char *)(&size),sizeof(SizeType));
1234 
1235  rData.resize(size);
1236 
1237  read(rData.begin(), rData.end(), sizeof(TDataType));
1238 
1240 
1241  std::size_t size;
1242  *mpBuffer >> size;
1243  rData.resize(size);
1244  mNumberOfLines++;
1245 
1246  read(rData.begin(), rData.end());
1247 
1249  }
1250 
1251  template<class TDataType>
1252  void write(std::vector<TDataType> const& rData)
1253  {
1255 
1256  SizeType rData_size = rData.size();
1257 
1258  const char * data = reinterpret_cast<const char *>(&rData_size);
1259  mpBuffer->write(data,sizeof(SizeType));
1260 
1261  write(rData.begin(), rData.end(), sizeof(TDataType));
1262 
1264 
1265  *mpBuffer << rData.size() << std::endl;
1266  write(rData.begin(), rData.end());
1267 
1269  }
1270 
1271 // template<class TDataType, std::size_t TDimenasion>
1272 // void read(array_1d<TDataType, TDimenasion>& rData)
1273 // {
1274 // read(rData.begin(), rData.end());
1275 // }
1276 //
1277 // template<class TDataType, std::size_t TDimension>
1278 // void write(array_1d<TDataType, TDimension> const& rData)
1279 // {
1280 // write(rData.begin(), rData.end());
1281 // }
1282 //
1283 // template<class TDataType>
1284 // void read(DenseVector<TDataType>& rData)
1285 // {
1286 // std::size_t size;
1287 // *mpBuffer >> size;
1288 // rData.resize(size,false);
1289 //
1290 // read(rData.begin(), rData.end());
1291 // }
1292 //
1293 // template<class TDataType>
1294 // void write(DenseVector<TDataType> const& rData)
1295 // {
1296 // *mpBuffer << rData.size() << std::endl;
1297 // write(rData.begin(), rData.end());
1298 // }
1299 
1300  template<class TDataType>
1301  void read(DenseMatrix<TDataType>& rData)
1302  {
1304 
1305  SizeType size1;
1306  SizeType size2;
1307 
1308  mpBuffer->read((char *)(&size1),sizeof(SizeType));
1309  mpBuffer->read((char *)(&size2),sizeof(SizeType));
1310 
1311  rData.resize(size1,size2);
1312 
1313  read(rData.data().begin(), rData.data().end(), sizeof(TDataType));
1314 
1316 
1317  SizeType size1;
1318  SizeType size2;
1319 
1320  *mpBuffer >> size1;
1321  mNumberOfLines++;
1322  *mpBuffer >> size2;
1323  mNumberOfLines++;
1324 
1325  rData.resize(size1,size2);
1326 
1327  read(rData.data().begin(), rData.data().end(),0);
1328 
1330  }
1331 
1332  template<class TDataType>
1333  void write(DenseMatrix<TDataType> const& rData)
1334  {
1336 
1337  SizeType rData_size1 = rData.size1();
1338  SizeType rData_size2 = rData.size2();
1339 
1340  const char * data1 = reinterpret_cast<const char *>(&rData_size1);
1341  const char * data2 = reinterpret_cast<const char *>(&rData_size2);
1342 
1343  mpBuffer->write(data1,sizeof(SizeType));
1344  mpBuffer->write(data2,sizeof(SizeType));
1345 
1346  write(rData.data().begin(), rData.data().end(), sizeof(TDataType));
1347 
1349 
1350  *mpBuffer << rData.size1() << std::endl;
1351  *mpBuffer << rData.size2() << std::endl;
1352 
1353  write(rData.data().begin(), rData.data().end(),0);
1354 
1356  }
1357 
1358  template<class TIteratorType>
1359  void read(TIteratorType First, TIteratorType Last, SizeType size)
1360  {
1362 
1363  for(; First != Last ; First++)
1364  {
1365  mpBuffer->read((char *)First,sizeof(size));
1366  }
1367 
1369 
1370  for(; First != Last ; First++)
1371  {
1372  *mpBuffer >> *First;
1373  mNumberOfLines++;
1374 
1375  }
1376 
1378  }
1379  template<class TIteratorType>
1380  void write(TIteratorType First, TIteratorType Last, SizeType size)
1381  {
1383 
1384  for(; First != Last ; First++)
1385  {
1386  const char * data = reinterpret_cast<const char *>(First);
1387  mpBuffer->write(data,sizeof(size));
1388  }
1389 
1391 
1392  for(; First != Last ; First++)
1393  *mpBuffer << *First << std::endl;
1394 
1396  }
1397 
1398  inline SizeType BlockCompatibleSize(SizeType rSize)
1399  {
1400  typedef char BlockType;
1401  const SizeType block_size = sizeof(BlockType);
1402  return static_cast<SizeType>(((block_size - 1) + rSize) / block_size);
1403  }
1404 
1406  void SeekBegin();
1407 
1409  void SeekEnd();
1410 
1414 
1415 
1419 
1420 
1424 
1426  Serializer& operator=(Serializer const& rOther);
1427 
1429  Serializer(Serializer const& rOther);
1430 
1432 
1433 }; // Class Serializer
1434 
1436 
1439 
1440 
1444 
1445 
1446 // template<class TDataType>
1447 // inline Serializer& operator >> (Serializer& rThis, TDataType& rObject)
1448 // {
1449 // rThis.load(rObject);
1450 
1451 // return rThis;
1452 // }
1453 
1454 
1455 // template<class TDataType>
1456 // inline Serializer& operator << (Serializer& rThis, TDataType& rObject)
1457 // {
1458 // rThis.save(rObject, KRATOS_VERSION);
1459 
1460 // return rThis;
1461 // }
1463 // inline std::istream& operator >> (std::istream& rIStream,
1464 // Serializer& rThis);
1465 
1467 // inline std::ostream& operator << (std::ostream& rOStream,
1468 // const Serializer& rThis)
1469 // {
1470 // rThis.PrintInfo(rOStream);
1471 // rOStream << std::endl;
1472 // rThis.PrintData(rOStream);
1473 
1474 // return rOStream;
1475 // }
1477 
1478 } // namespace Kratos.
1479 
1480 #undef KRATOS_SERIALIZER_MODE_BINARY
1481 #undef KRATOS_SERIALIZER_MODE_ASCII
1482 #undef KRATOS_SERIALIZER_MODE_END
1483 
1484 #undef KRATOS_SERIALIZATION_DIRECT_LOAD
1485 #undef KRATOS_SERIALIZATION_DIRECT_SAVE
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Definition: flags.h:58
Definition: amatrix_interface.h:41
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
std::map< std::string, std::string > RegisteredObjectsNameContainerType
Definition: serializer.h:149
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, const char *pValue)
Definition: serializer.h:736
PointerType
Definition: serializer.h:128
void load(std::string const &rTag, Kratos::weak_ptr< TDataType > &pValue)
Definition: serializer.h:402
virtual ~Serializer()
Destructor.
Definition: serializer.h:166
void load(std::string const &rTag, std::vector< TDataType > &rObject)
Definition: serializer.h:434
void load(std::string const &rTag, array_1d< TDataType, TDimension > &rObject)
Definition: serializer.h:489
void load(std::string const &rTag, std::unordered_set< TDataType > &rObject)
Definition: serializer.h:483
void save(std::string const &rTag, array_1d< TDataType, TDimension > const &rObject)
Definition: serializer.h:589
void load(std::string const &rTag, BoundedMatrix< TDataType, TDimension1, TDimension2 > &rObject)
Definition: serializer.h:517
TraceType
Definition: serializer.h:129
void load(std::string const &rTag, DenseVector< TDataType > &rObject)
Definition: serializer.h:449
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: serializer.h:962
bool Is(Flags const &rOtherFlag) const
Definition: serializer.h:946
static void * Create()
Definition: serializer.h:192
void save(std::string const &rTag, Kratos::unique_ptr< TDataType > const &pValue)
Definition: serializer.h:651
std::map< std::string, ObjectFactoryType > RegisteredObjectsContainerType
Definition: serializer.h:147
void save(std::string const &rTag, const TDataType *pValue)
Definition: serializer.h:657
TraceType GetTraceType() const
Definition: serializer.h:184
std::size_t SizeType
Definition: serializer.h:141
void load_base(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:791
void save(std::string const &rTag, Kratos::intrusive_ptr< TDataType > pValue)
Definition: serializer.h:644
void save_base(std::string const &rTag, DenseVector< TDataType > const &rObject)
Definition: serializer.h:827
void load(std::string const &rTag, std::map< TKeyType, TDataType > &rObject)
Definition: serializer.h:465
void load(std::string const &rTag, std::pair< TFirstType, TSecondType > &rObject)
Definition: serializer.h:499
void save(std::string const &rTag, TDataType const &rObject)
Definition: serializer.h:623
void RedirectLoadingPointer(void *pStoredPointer, void *pAllocatedPosition)
Definition: serializer.h:923
void load_base(std::string const &rTag, array_1d< TDataType, TDimension > &rObject)
Definition: serializer.h:813
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
void load(std::string const &rTag, std::array< TDataType, TDataSize > &rObject)
Definition: serializer.h:426
void load(std::string const &rTag, TDataType *&pValue)
Definition: serializer.h:349
void save(std::string const &rTag, std::map< TKeyType, TDataType > const &rObject)
Definition: serializer.h:599
void save(std::string const &rTag, DenseVector< TDataType > const &rObject)
Definition: serializer.h:576
void save_base(std::string const &rTag, std::vector< TDataType > const &rObject)
Definition: serializer.h:820
BufferType * pGetBuffer()
Definition: serializer.h:903
void Set(const Flags ThisFlag)
Definition: serializer.h:937
virtual std::string Info() const
Turn back information as a string.
Definition: serializer.h:956
void load_base(std::string const &rTag, std::vector< TDataType > &rObject)
Definition: serializer.h:799
void load(std::string const &rTag, Kratos::shared_ptr< TDataType > &pValue)
Definition: serializer.h:214
void load(std::string const &rTag, BoundedVector< TDataType, TDimension > &rObject)
Definition: serializer.h:507
void save(std::string const &rTag, TDataType *pValue)
Definition: serializer.h:690
void save(std::string const &rTag, std::unordered_map< TKeyType, TDataType > const &rObject)
Definition: serializer.h:605
void save(std::string const &rTag, Kratos::WeakPointerVector< TDataType > pValue)
Definition: serializer.h:720
static RegisteredObjectsNameContainerType & GetRegisteredObjectsName()
Definition: serializer.h:932
void AddToSavedPointers(const TDataType &pValue)
Definition: serializer.h:914
KRATOS_DEFINE_LOCAL_FLAG(SHALLOW_GLOBAL_POINTERS_SERIALIZATION)
void load(std::string const &rTag, const Variable< TDataType > *)
Definition: serializer.h:418
void SetBuffer(BufferType *pBuffer)
Definition: serializer.h:186
void save(std::string const &rTag, std::set< TDataType > const &rObject)
Definition: serializer.h:611
Serializer(BufferType *pBuffer, TraceType const &rTrace=SERIALIZER_NO_TRACE)
Default constructor.
Definition: serializer.h:160
std::iostream BufferType
Definition: serializer.h:153
KRATOS_CLASS_POINTER_DEFINITION(Serializer)
Pointer definition of Serializer.
bool load_trace_point(std::string const &rTag)
Definition: serializer.h:855
void load(std::string const &rTag, std::set< TDataType > &rObject)
Definition: serializer.h:477
void save(std::string const &rTag, std::pair< TFirstType, TSecondType > rObject)
Definition: serializer.h:744
void save(std::string const &rTag, Kratos::shared_ptr< TDataType > pValue)
Definition: serializer.h:638
void load(std::string const &rTag, std::unordered_map< TKeyType, TDataType > &rObject)
Definition: serializer.h:471
void load_base(std::string const &rTag, DenseVector< TDataType > &rObject)
Definition: serializer.h:806
void save(std::string const &rTag, const Variable< TDataType > *pVariable)
Definition: serializer.h:630
void save_trace_point(std::string const &rTag)
Definition: serializer.h:847
std::map< void *, void * > LoadedPointersContainerType
Definition: serializer.h:145
void load(std::string const &rTag, Kratos::unique_ptr< TDataType > &pValue)
Definition: serializer.h:304
static RegisteredObjectsContainerType & GetRegisteredObjects()
Definition: serializer.h:927
void save(std::string const &rTag, BoundedMatrix< TDataType, TDimension1, TDimension2 > const &rObject)
Definition: serializer.h:762
void save(std::string const &rTag, std::unordered_set< TDataType > const &rObject)
Definition: serializer.h:617
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: serializer.h:966
void save_base(std::string const &rTag, TDataType const &rObject)
Definition: serializer.h:841
void save(std::string const &rTag, Kratos::shared_ptr< const TDataType > pValue)
Definition: serializer.h:728
void save(std::string const &rTag, BoundedVector< TDataType, TDimension > const &rObject)
Definition: serializer.h:752
void save(std::string const &rTag, Kratos::weak_ptr< TDataType > pValue)
Definition: serializer.h:712
void load(std::string const &rTag, Kratos::intrusive_ptr< TDataType > &pValue)
Definition: serializer.h:259
bool IsDerived(TDataType *pValue)
Definition: serializer.h:675
void save_base(std::string const &rTag, array_1d< TDataType, TDimension > const &rObject)
Definition: serializer.h:834
void load(std::string const &rTag, WeakPointerVector< TDataType > &pValue)
Definition: serializer.h:410
void save(std::string const &rTag, std::vector< TDataType > const &rObject)
Definition: serializer.h:553
std::set< const void * > SavedPointersContainerType
Definition: serializer.h:151
static void Register(std::string const &rName, TDataType const &pPrototype)
Definition: serializer.h:198
const std::string & Name() const
Definition: variable_data.h:201
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
WeakPointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: weak_pointer_vector.h:67
Short class definition.
Definition: array_1d.h:61
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_INFO(label)
Definition: logger.h:250
Kratos::ModelPart ModelPart
Definition: kratos_wrapper.h:31
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::weak_ptr< T > weak_ptr
Definition: smart_pointers.h:30
REACTION_CHECK_STIFFNESS_FACTOR INNER_LOOP_ITERATION DISTANCE_THRESHOLD ACTIVE_CHECK_FACTOR AUXILIAR_COORDINATES NORMAL_GAP WEIGHTED_GAP WEIGHTED_SCALAR_RESIDUAL bool
Definition: contact_structural_mechanics_application_variables.h:93
std::shared_ptr< T > shared_ptr
Definition: smart_pointers.h:27
std::unique_ptr< T > unique_ptr
Definition: smart_pointers.h:33
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
type
Definition: generate_gid_list_file.py:35
int block_size
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:16
data
Definition: mesh_to_mdpa_converter.py:59
def load(f)
Definition: ode_solve.py:307
int j
Definition: quadrature.py:648
float temp
Definition: rotating_cone.py:85
integer i
Definition: TensorModule.f:17
#define KRATOS_SERIALIZER_MODE_ASCII
Definition: serializer.h:77
#define KRATOS_SERIALIZER_MODE_BINARY
Definition: serializer.h:75
#define KRATOS_SERIALIZATION_DIRECT_SAVE(type)
Definition: serializer.h:54
#define KRATOS_SERIALIZER_MODE_END
Definition: serializer.h:79
#define KRATOS_SERIALIZATION_DIRECT_LOAD(type)
Definition: serializer.h:36