ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
CaDiCaL::Mapper Struct Reference
Collaboration diagram for CaDiCaL::Mapper:

Public Member Functions

 Mapper (Internal *i)
 
 ~Mapper ()
 
int map_idx (int src)
 
int map_lit (int src)
 
template<class T>
void map_vector (vector< T > &v)
 
template<class T>
void map2_vector (vector< T > &v)
 
void map_flush_and_shrink_lits (vector< int > &v)
 

Public Attributes

Internalinternal
 
int new_max_var
 
int * table
 
int first_fixed
 
int map_first_fixed
 
signed char first_fixed_val
 
size_t new_vsize
 

Detailed Description

Definition at line 35 of file cadical_compact.cpp.

Constructor & Destructor Documentation

◆ Mapper()

CaDiCaL::Mapper::Mapper ( Internal * i)
inline

Definition at line 53 of file cadical_compact.cpp.

55 first_fixed_val (0) {
56 table = new int[internal->max_var + 1u];
57 clear_n (table, internal->max_var + 1u);
58
59 CADICAL_assert (!internal->level);
60
61 for (auto src : internal->vars) {
62 const Flags &f = internal->flags (src);
63 if (f.active ())
64 table[src] = ++new_max_var;
65 else if (f.fixed () && !first_fixed)
67 }
68
71 }
#define CADICAL_assert(ignore)
Definition global.h:14
void clear_n(T *base, size_t n)
Definition util.hpp:149
signed char first_fixed_val
Here is the call graph for this function:

◆ ~Mapper()

CaDiCaL::Mapper::~Mapper ( )
inline

Definition at line 73 of file cadical_compact.cpp.

73{ delete[] table; }

Member Function Documentation

◆ map2_vector()

template<class T>
void CaDiCaL::Mapper::map2_vector ( vector< T > & v)
inline

Definition at line 126 of file cadical_compact.cpp.

126 {
127 for (auto src : internal->vars) {
128 const int dst = map_idx (src);
129 if (!dst)
130 continue;
131 CADICAL_assert (0 < dst);
132 CADICAL_assert (dst <= src);
133 v[2 * dst] = v[2 * src];
134 v[2 * dst + 1] = v[2 * src + 1];
135 }
136 v.resize (2 * new_vsize);
137 shrink_vector (v);
138 }
void shrink_vector(std::vector< T > &v)
Definition util.hpp:101
int map_idx(int src)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ map_flush_and_shrink_lits()

void CaDiCaL::Mapper::map_flush_and_shrink_lits ( vector< int > & v)
inline

Definition at line 144 of file cadical_compact.cpp.

144 {
145 const auto end = v.end ();
146 auto j = v.begin (), i = j;
147 for (; i != end; i++) {
148 const int src = *i;
149 int dst = map_idx (abs (src));
150 CADICAL_assert (abs (dst) <= abs (src));
151 if (!dst)
152 continue;
153 if (src < 0)
154 dst = -dst;
155 *j++ = dst;
156 }
157 v.resize (j - v.begin ());
158 shrink_vector (v);
159 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ map_idx()

int CaDiCaL::Mapper::map_idx ( int src)
inline

Definition at line 78 of file cadical_compact.cpp.

78 {
79 CADICAL_assert (0 < src);
80 CADICAL_assert (src <= internal->max_var);
81 const int res = table[src];
83 return res;
84 }
Here is the caller graph for this function:

◆ map_lit()

int CaDiCaL::Mapper::map_lit ( int src)
inline

Definition at line 91 of file cadical_compact.cpp.

91 {
92 int res = map_idx (abs (src));
93 if (!res) {
94 const signed char tmp = internal->val (src);
95 if (tmp) {
97 res = map_first_fixed;
98 if (tmp != first_fixed_val)
99 res = -res;
100 }
101 } else if ((src) < 0)
102 res = -res;
103 CADICAL_assert (abs (res) <= new_max_var);
104 return res;
105 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ map_vector()

template<class T>
void CaDiCaL::Mapper::map_vector ( vector< T > & v)
inline

Definition at line 110 of file cadical_compact.cpp.

110 {
111 for (auto src : internal->vars) {
112 const int dst = map_idx (src);
113 if (!dst)
114 continue;
115 CADICAL_assert (0 < dst);
116 CADICAL_assert (dst <= src);
117 v[dst] = v[src];
118 }
119 v.resize (new_vsize);
120 shrink_vector (v);
121 }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ first_fixed

int CaDiCaL::Mapper::first_fixed

Definition at line 40 of file cadical_compact.cpp.

◆ first_fixed_val

signed char CaDiCaL::Mapper::first_fixed_val

Definition at line 42 of file cadical_compact.cpp.

◆ internal

Internal* CaDiCaL::Mapper::internal

Definition at line 37 of file cadical_compact.cpp.

◆ map_first_fixed

int CaDiCaL::Mapper::map_first_fixed

Definition at line 41 of file cadical_compact.cpp.

◆ new_max_var

int CaDiCaL::Mapper::new_max_var

Definition at line 38 of file cadical_compact.cpp.

◆ new_vsize

size_t CaDiCaL::Mapper::new_vsize

Definition at line 43 of file cadical_compact.cpp.

◆ table

int* CaDiCaL::Mapper::table

Definition at line 39 of file cadical_compact.cpp.


The documentation for this struct was generated from the following file: