-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement FieldData::clone() #163
Conversation
apf/apfFieldData.cc
Outdated
FieldData* FieldData::clone() | ||
{ | ||
abort(); | ||
FieldData* newData = new TagDataOf<double>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to commit to all copied fields being created as mesh tags?
Certainly all fields using the primary apf interfaces in apf.h are mesh tag fields but I'm not sure we want to have references to a subclass in a superclass. Should clone()
be virtual and the type created depend on the subclass type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really up to you and @cwsmith. it was not pure virtual originally, so I just implemented it as that implied.
apf/apfArrayData.cc
Outdated
for (int i=0; i<num_nodes*num_components; i++) { | ||
data[i] = this->dataArray[start+i]; | ||
} | ||
template <class T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this all whitespace changes?
If so revert these edits.
apf/apfFieldData.cc
Outdated
FieldData* FieldData::clone() | ||
{ | ||
abort(); | ||
FieldData* newData = new TagDataOf<double>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be templated, so we don't have to use only a double field.
apf/apfArrayData.h
Outdated
template <class T> | ||
void unfreezeFieldData(FieldBase* base); | ||
template <class T> | ||
class ArrayDataOf : public FieldDataOf<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this class need to be exposed? Is it used somewhere else in the commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake. I was using this in a previous attempt to get this working.
@TobinW can you take another look at this. Some of my commits are a bit messy, so if under diff settings you change it to all commits rather than the last one you can see in sum what changed. If things look good to you I will squash all of my commits down into one. |
apf/apfFieldData.cc
Outdated
@@ -1,6 +1,9 @@ | |||
#include <PCU.h> | |||
#include "apfFieldData.h" | |||
#include "apfShape.h" | |||
#include "apfArrayData.h" | |||
#include "apf.h" | |||
#include "apfTagData.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need to remove these.
@Timetravellers This looks like a better approach to me, just need to remove a couple #include directives. @cwsmith Anything jumping out at you? |
this adds an implementation to clone field data which is needed for apf::convert to copy fields. closes SCOREC#162
5852fd3
to
686a923
Compare
@TobinW I am finally done with this. We at least clone all mesh data that is used in tobinw/biotissue |
The one possibility where this breaks downstream code is if the user copies fields/tags etc. on their own. The downstream user no longer needs to copy fields when using |
@cwsmith can you merge this? or are there more edits that need to be made? |
I hit a compile error on pachisi using gcc 7.3.0
|
@cwsmith see if that fixes the issue. |
this adds an implementation to clone field data which is needed for
apf::convert to copy fields. closes #162