------------------------------------------------------------------------------ Deep copy of another bit array.
| 213 | //------------------------------------------------------------------------------ |
| 214 | // Deep copy of another bit array. |
| 215 | void vtkBitArray::DeepCopy(vtkDataArray* ia) |
| 216 | { |
| 217 | // Do nothing on a nullptr input. |
| 218 | if (ia == nullptr) |
| 219 | { |
| 220 | return; |
| 221 | } |
| 222 | |
| 223 | this->DataChanged(); |
| 224 | |
| 225 | if (ia->GetDataType() != vtkBitArray::DataTypeTag::value) |
| 226 | { |
| 227 | vtkIdType numTuples = ia->GetNumberOfTuples(); |
| 228 | this->NumberOfComponents = ia->GetNumberOfComponents(); |
| 229 | this->SetNumberOfTuples(numTuples); |
| 230 | |
| 231 | for (vtkIdType i = 0; i < numTuples; i++) |
| 232 | { |
| 233 | this->SetTuple(i, ia->GetTuple(i)); |
| 234 | } |
| 235 | return; |
| 236 | } |
| 237 | |
| 238 | if (this != ia) |
| 239 | { |
| 240 | if (this->DeleteFunction) |
| 241 | { |
| 242 | this->DeleteFunction(this->Array); |
| 243 | } |
| 244 | |
| 245 | this->NumberOfComponents = ia->GetNumberOfComponents(); |
| 246 | this->MaxId = ia->GetMaxId(); |
| 247 | this->Size = ia->GetSize(); |
| 248 | this->DeleteFunction = ::operator delete[]; |
| 249 | |
| 250 | this->Array = new ValueType[(this->Size + 7) / 8]; |
| 251 | memcpy(this->Array, static_cast<ValueType*>(ia->GetVoidPointer(0)), |
| 252 | static_cast<size_t>((this->Size + 7) / 8) * sizeof(ValueType)); |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | //------------------------------------------------------------------------------ |
| 257 | void vtkBitArray::PrintSelf(ostream& os, vtkIndent indent) |
no test coverage detected