void Foam::pointMesh::updateMesh(const mapPolyMesh& mpm) { boundary_.updateMesh(); // Map all registered point fields mapFields(mpm); }
void Foam::pointMesh::updateMesh(const mapPolyMesh& mpm) { if (debug) { Pout<< "pointMesh::updateMesh(const mapPolyMesh&): " << "Updating for topology changes." << endl; Pout<< endl; } boundary_.updateMesh(); // Map all registered point fields mapFields(mpm); }
void JavaClass::setJavaObject(JNIEnv *env, jobject javaThis) { LOG_DEBUG("Setting fields from Java object of type '%s' to native instance", getSimpleName()); // Set up field mappings, if this has not already been done if (_field_mappings.empty()) { mapFields(); } for (FieldMap::const_iterator iter = _fields->begin(); iter != _fields->end(); ++iter) { std::string key = iter->first; LOG_DEBUG("Copying field '%s'", key.c_str()); jfieldID field = iter->second; const FieldMapping *mapping = getFieldMapping(key.c_str()); if (field != NULL && mapping != NULL) { if (TYPE_EQUALS(mapping->type, kTypeInt)) { int *address = static_cast<int*>(mapping->address); *address = env->GetIntField(javaThis, field); } else if (TYPE_EQUALS(mapping->type, kTypeShort)) { short *address = static_cast<short*>(mapping->address); *address = env->GetShortField(javaThis, field); } else if (TYPE_EQUALS(mapping->type, kTypeBool)) { bool *address = static_cast<bool*>(mapping->address); // The somewhat odd "? true : false" fixes a performance warning on windows, // since GetBooleanField actually returns jboolean, not bool. *address = env->GetBooleanField(javaThis, field) ? true : false; } else if (TYPE_EQUALS(mapping->type, kTypeFloat)) { float *address = static_cast<float*>(mapping->address); *address = env->GetFloatField(javaThis, field); } else if (TYPE_EQUALS(mapping->type, kTypeDouble)) { double *address = static_cast<double*>(mapping->address); *address = env->GetDoubleField(javaThis, field); } else if (TYPE_EQUALS(mapping->type, kTypeString)) { jstring string = (jstring)env->GetObjectField(javaThis, field); JavaString *address = static_cast<JavaString*>(mapping->address); address->set(env, string); } else if (TYPE_EQUALS(mapping->type, kTypeByte)) { unsigned char *address = static_cast<unsigned char*>(mapping->address); *address = env->GetByteField(javaThis, field); } else if (TYPE_EQUALS(mapping->type, kTypeChar)) { wchar_t *address = static_cast<wchar_t*>(mapping->address); *address = env->GetCharField(javaThis, field); } else { LOG_ERROR("Unable to copy data to field '%s'", key.c_str()); } } } }
jobject JavaClass::toJavaObject(JNIEnv *env) { LOG_DEBUG("Converting native instance of '%s' to Java instance", getSimpleName()); if (_default_constructor == NULL) { JavaExceptionUtils::throwExceptionOfType(env, kTypeIllegalStateException, "Cannot call toJavaObject without a constructor (did you forget to call cacheConstructor() in initialize()?"); return NULL; } else if (!isInitialized()) { JavaExceptionUtils::throwExceptionOfType(env, kTypeIllegalStateException, "Cannot call toJavaObject without registering class info"); return NULL; } // Set up field mappings, if this has not already been done if (_field_mappings.empty()) { mapFields(); } JniLocalRef<jobject> result; result.set(env->NewObject(_clazz, _default_constructor)); return toJavaObject(env, result.leak()); }
void Foam::fvMesh::updateMesh(const mapPolyMesh& mpm) { // Update polyMesh. This needs to keep volume existent! polyMesh::updateMesh(mpm); surfaceInterpolation::clearOut(); clearGeomNotOldVol(); // Map all fields mapFields(mpm); // Map old-volumes mapOldVolumes(mpm); clearAddressing(); // Mesh morphing should also clear out the surfaceInterpolation. // This is a temporary solution surfaceInterpolation::movePoints(); // Function object update moved to polyMesh // HJ, 29/Aug/2010 }