FEDEM Model Database  R8.0
Source code of the FEDEM model database
FFlVTFWriter.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
8 #ifndef FFL_VTF_WRITER_H
9 #define FFL_VTF_WRITER_H
10 
11 #include <string>
12 #include <vector>
13 #include <set>
14 #include <map>
15 
17 
18 class VTFAFile;
19 
20 #ifdef FF_NAMESPACE
21 namespace FF_NAMESPACE {
22 #endif
23 
24 
26 {
27 public:
28  FFlVTFWriter(const FFlLinkHandler* link);
29  FFlVTFWriter(const FFlVTFWriter&) = delete;
30  virtual ~FFlVTFWriter();
31 
32  FFlVTFWriter& operator=(const FFlVTFWriter&) = delete;
33 
34  bool write(const std::string& filename, const std::string& partname,
35  int ID = 1, int type = 0);
36 
37  bool write(VTFAFile& file, const std::string& partname, int ID = 1,
38  std::vector<int>* outputOrder = NULL,
39  std::vector<int>* firstOrderNodes = NULL);
40 
41  // Mapping from Fedem node order to VTF order
42  static const int T6m[6];
43  static const int Q8m[8];
44  static const int T10m[10];
45  static const int P15m[15];
46  static const int H20m[20];
47 
48 protected:
49  bool writeNodes(int blockID, bool withID = true);
50  bool writeElements(const std::string& partName, int blockID, int nodesID,
51  bool withID = true, bool convTo1stOrder = false);
52  bool writeGeometry(const int* parts, int nPart);
53  bool writeProperties(int blockID);
54 
55  bool showError(const char* msg, int ID = 0);
56 
57 private:
59  std::vector<int> myOrder;
60  std::set<int> myNodes;
61  std::map<int,int> myNodMap;
62 };
63 
64 #ifdef FF_NAMESPACE
65 } // namespace
66 #endif
67 #endif
Container class for finite element models.
Definition: FFlLinkHandler.H:95
Definition: FFlVTFWriter.H:26
FFlVTFWriter & operator=(const FFlVTFWriter &)=delete
VTFAFile * myFile
Definition: FFlVTFWriter.H:58
std::map< int, int > myNodMap
Definition: FFlVTFWriter.H:61
std::set< int > myNodes
Definition: FFlVTFWriter.H:60
FFlVTFWriter(const FFlVTFWriter &)=delete
std::vector< int > myOrder
Definition: FFlVTFWriter.H:59
Definition: FFlWriterBase.H:23
Definition: FFlVTFWriter.C:21
int write(FILE *fd, const char *tag, int nchar, unsigned int cs, int tagLength=LEN_TAG)
Writes the file tag and checksum to the provided file.
Definition: FFaTag.C:325