CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[mesh manipulation] MapConsistentVolField.H and IOobjectList

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 5, 2018, 04:17
Default MapConsistentVolField.H and IOobjectList
  #1
Senior Member
 
krishna kant
Join Date: Feb 2016
Location: Hyderabad, India
Posts: 133
Rep Power: 10
kk415 is on a distinguished road
Hi I am new in C++ so I dont know the structure database used in openFoam. The problem I am facing is typically a programming language problem. I dont know the correct command for my purpose. Any help will be deeply appreciated.

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.

OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.

\*---------------------------------------------------------------------------*/

#ifndef MapConsistentVolFields_H
#define MapConsistentVolFields_H

#include "GeometricField.H"
#include "meshToMesh0.H"
#include "IOobjectList.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

template<class Type, class CombineOp>
void MapConsistentVolFields
(
const IOobjectList& objects,
const meshToMesh0& meshToMesh0Interp,
const meshToMesh0:rder& mapOrder,
const CombineOp& cop
)
{
const fvMesh& meshSource = meshToMesh0Interp.fromMesh();
const fvMesh& meshTarget = meshToMesh0Interp.toMesh();

word fieldClassName
(
GeometricField<Type, fvPatchField, volMesh>::typeName
);

IOobjectList fields = objects.lookupClass(fieldClassName);
Info<< " interpolating " << fields.lookup(name)
<< endl;
forAllIter(IOobjectList, fields, fieldIter)
{

Info<< " interpolating " << fieldIter()->name()
<< endl;

// Read field
GeometricField<Type, fvPatchField, volMesh> fieldSource
(
*fieldIter(),
meshSource
);

IOobject fieldTargetIOobject
(
fieldIter()->name(),
meshTarget.time().timeName(),
meshTarget,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
);

if (fieldTargetIOobject.headerOk())
{
// Read fieldTarget
GeometricField<Type, fvPatchField, volMesh> fieldTarget
(
fieldTargetIOobject,
meshTarget
);

// Interpolate field
meshToMesh0Interp.interpolate
(
fieldTarget,
fieldSource,
mapOrder,
cop
);

// Write field
fieldTarget.write();
}
else
{
fieldTargetIOobject.readOpt() = IOobject::NO_READ;

// Interpolate field
GeometricField<Type, fvPatchField, volMesh> fieldTarget
(
fieldTargetIOobject,
meshToMesh0Interp.interpolate
(
fieldSource,
mapOrder,
cop
)
);

// Write field
fieldTarget.write();
}
}
}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************** *********************** //


The above is a code for MapConsistentVolField.H, I have issue with the line highlighted/underlined. In that line the "fields" is suppose to take list of all the variables like P,T for classtype volScalar. How can I check that list of variables stored in fields.

I am trying commands like fields.lookup(name) to know the name of the variables that is in the list of fields. It is showing error "MapConsistentVolFields.H:56:52: error: no matching function for call to ‘Foam::IOobjectList::lookup(<unresolved overloaded function type>)’". what is the correct command for this purpose?
kk415 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM] Acquiring scalar names tj22 ParaView 4 May 17, 2006 13:01


All times are GMT -4. The time now is 10:08.