Skip to content

Commit

Permalink
[insitu] Clang-format.
Browse files Browse the repository at this point in the history
  • Loading branch information
bilke committed Mar 23, 2017
1 parent 4e61226 commit 8acf2d0
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 28 deletions.
6 changes: 4 additions & 2 deletions Applications/InSituLib/Adaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ namespace InSituLib
{
vtkCPProcessor* Processor = nullptr;

void Initialize(BaseLib::ConfigTree const & scripts_config, std::string const & path)
void Initialize(BaseLib::ConfigTree const& scripts_config,
std::string const& path)
{
if (Processor == nullptr)
{
Expand Down Expand Up @@ -74,7 +75,8 @@ void CoProcess(MeshLib::Mesh const& mesh, double const time,
vtkNew<MeshLib::VtkMappedMeshSource> vtkSource;
vtkSource->SetMesh(&mesh);
vtkSource->Update();
dataDescription->GetInputDescriptionByName("input")->SetGrid(vtkSource->GetOutput());
dataDescription->GetInputDescriptionByName("input")->SetGrid(
vtkSource->GetOutput());
Processor->CoProcess(dataDescription.GetPointer());
INFO("End InSitu process.");
}
Expand Down
8 changes: 4 additions & 4 deletions Applications/InSituLib/Adaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ namespace MeshLib {
}

namespace InSituLib {

void Initialize(BaseLib::ConfigTree const & scripts_config, std::string const & path);
void Initialize(BaseLib::ConfigTree const& scripts_config,
std::string const& path);
void Finalize();
void CoProcess( MeshLib::Mesh const & mesh, double const time, unsigned int const timeStep, bool const lastTimeStep);

void CoProcess(MeshLib::Mesh const& mesh, double const time,
unsigned int const timeStep, bool const lastTimeStep);
}
5 changes: 3 additions & 2 deletions MeshLib/Vtk/VtkMappedMeshSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace MeshLib
{
vtkStandardNewMacro(VtkMappedMeshSource)

void VtkMappedMeshSource::PrintSelf(std::ostream& os, vtkIndent indent)
void VtkMappedMeshSource::PrintSelf(std::ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "Mesh: " << (_mesh ? _mesh->getName() : "(none)") << endl;
Expand Down Expand Up @@ -131,7 +131,8 @@ int VtkMappedMeshSource::RequestData(vtkInformation*,
properties.getPropertyVectorNames();

for (std::vector<std::string>::const_iterator name = propertyNames.cbegin();
name != propertyNames.cend(); ++name)
name != propertyNames.cend();
++name)
{
if (addProperty<double>(properties, *name))
continue;
Expand Down
48 changes: 28 additions & 20 deletions MeshLib/Vtk/VtkMappedMeshSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,34 @@ class Mesh;
class VtkMappedMeshSource final : public vtkUnstructuredGridAlgorithm
{
public:
static VtkMappedMeshSource *New();
static VtkMappedMeshSource* New();
vtkTypeMacro(VtkMappedMeshSource, vtkUnstructuredGridAlgorithm);
void PrintSelf(std::ostream &os, vtkIndent indent) override;
void PrintSelf(std::ostream& os, vtkIndent indent) override;

/// Sets the mesh. Calling is mandatory
void SetMesh(const MeshLib::Mesh* mesh) { this->_mesh = mesh; this->Modified(); }
void SetMesh(const MeshLib::Mesh* mesh)
{
this->_mesh = mesh;
this->Modified();
}

/// Returns the mesh.
const MeshLib::Mesh* GetMesh() const { return _mesh; }

protected:
VtkMappedMeshSource();

int ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector,
vtkInformationVector *outputVector) override;
int RequestData(vtkInformation *, vtkInformationVector **,
vtkInformationVector *) override;
int RequestInformation(vtkInformation *, vtkInformationVector **,
vtkInformationVector *) override;
int ProcessRequest(vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector) override;
int RequestData(vtkInformation*, vtkInformationVector**,
vtkInformationVector*) override;
int RequestInformation(vtkInformation*, vtkInformationVector**,
vtkInformationVector*) override;

private:
VtkMappedMeshSource(const VtkMappedMeshSource &); // Not implemented.
void operator=(const VtkMappedMeshSource &); // Not implemented.
VtkMappedMeshSource(const VtkMappedMeshSource&); // Not implemented.
void operator=(const VtkMappedMeshSource&); // Not implemented.

/// Adds a zero-copy vtk array wrapper.
/// \param properties MeshLib::Properties object
Expand All @@ -80,24 +85,27 @@ class VtkMappedMeshSource final : public vtkUnstructuredGridAlgorithm
if (!properties.existsPropertyVector<T>(prop_name))
return false;
// TODO: Hack removing const
auto* propertyVector = const_cast<MeshLib::PropertyVector<T> *>(
auto* propertyVector = const_cast<MeshLib::PropertyVector<T>*>(
properties.getPropertyVector<T>(prop_name));
if(!propertyVector)
if (!propertyVector)
return false;

vtkNew<vtkAOSDataArrayTemplate<T> > dataArray;
vtkNew<vtkAOSDataArrayTemplate<T>> dataArray;
const bool hasArrayOwnership = false;
dataArray->SetArray(propertyVector->data(),
static_cast<vtkIdType>(propertyVector->size()),
static_cast<int>(!hasArrayOwnership));
dataArray->SetNumberOfComponents(propertyVector->getNumberOfComponents());
static_cast<vtkIdType>(propertyVector->size()),
static_cast<int>(!hasArrayOwnership));
dataArray->SetNumberOfComponents(
propertyVector->getNumberOfComponents());
dataArray->SetName(prop_name.c_str());

if(propertyVector->getMeshItemType() == MeshLib::MeshItemType::Node)
if (propertyVector->getMeshItemType() == MeshLib::MeshItemType::Node)
this->PointData->AddArray(dataArray.GetPointer());
else if(propertyVector->getMeshItemType() == MeshLib::MeshItemType::Cell)
else if (propertyVector->getMeshItemType() ==
MeshLib::MeshItemType::Cell)
this->CellData->AddArray(dataArray.GetPointer());
else if(propertyVector->getMeshItemType() == MeshLib::MeshItemType::IntegrationPoint)
else if (propertyVector->getMeshItemType() ==
MeshLib::MeshItemType::IntegrationPoint)
this->FieldData->AddArray(dataArray.GetPointer());

return true;
Expand Down

0 comments on commit 8acf2d0

Please sign in to comment.